Implement input stub in the host side for chromoting

Implement InputStub for the host.

BUG=None
TEST=None

Review URL: http://codereview.chromium.org/4726003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66314 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc
index 98d9303..0d4b80e 100644
--- a/remoting/host/simple_host_process.cc
+++ b/remoting/host/simple_host_process.cc
@@ -71,20 +71,26 @@
   const CommandLine* cmd_line = CommandLine::ForCurrentProcess();
 
   base::AtExitManager exit_manager;
-
   base::EnsureNSPRInit();
 
+  // Allocate a chromoting context and starts it.
+  remoting::ChromotingHostContext context;
+  context.Start();
+
   scoped_ptr<remoting::Capturer> capturer;
-  scoped_ptr<remoting::EventExecutor> event_handler;
+  scoped_ptr<remoting::protocol::InputStub> input_stub;
 #if defined(OS_WIN)
   capturer.reset(new remoting::CapturerGdi());
-  event_handler.reset(new remoting::EventExecutorWin(capturer.get()));
+  input_stub.reset(new remoting::EventExecutorWin(
+      context.capture_message_loop(), capturer.get()));
 #elif defined(OS_LINUX)
   capturer.reset(new remoting::CapturerLinux());
-  event_handler.reset(new remoting::EventExecutorLinux(capturer.get()));
+  input_stub.reset(new remoting::EventExecutorLinux(
+      context.capture_message_loop(), capturer.get()));
 #elif defined(OS_MACOSX)
   capturer.reset(new remoting::CapturerMac());
-  event_handler.reset(new remoting::EventExecutorMac(capturer.get()));
+  input_stub.reset(new remoting::EventExecutorMac(
+      context.capture_message_loop(), capturer.get()));
 #endif
 
   // Check the argument to see if we should use a fake capturer.
@@ -117,13 +123,10 @@
 
   if (!config->Read()) {
     LOG(ERROR) << "Failed to read configuration file " << config_path.value();
+    context.Stop();
     return 1;
   }
 
-  // Allocate a chromoting context and starts it.
-  remoting::ChromotingHostContext context;
-  context.Start();
-
   FilePath module_path;
   PathService::Get(base::DIR_MODULE, &module_path);
   CHECK(media::InitializeMediaLibrary(module_path))
@@ -134,7 +137,7 @@
       new remoting::ChromotingHost(&context,
                                    config,
                                    capturer.release(),
-                                   event_handler.release()));
+                                   input_stub.release()));
 
   // Let the chromoting host run until the shutdown task is executed.
   MessageLoop message_loop(MessageLoop::TYPE_UI);