Move creation of capturer, input stub into ChromotingHost
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/5065001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66390 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc
index 0a6ff42..5decb81 100644
--- a/remoting/host/simple_host_process.cc
+++ b/remoting/host/simple_host_process.cc
@@ -36,17 +36,6 @@
#include "remoting/proto/video.pb.h"
#if defined(OS_WIN)
-#include "remoting/host/capturer_gdi.h"
-#include "remoting/host/event_executor_win.h"
-#elif defined(OS_LINUX)
-#include "remoting/host/capturer_linux.h"
-#include "remoting/host/event_executor_linux.h"
-#elif defined(OS_MACOSX)
-#include "remoting/host/capturer_mac.h"
-#include "remoting/host/event_executor_mac.h"
-#endif
-
-#if defined(OS_WIN)
const std::wstring kDefaultConfigPath = L".ChromotingConfig.json";
const wchar_t kHomeDrive[] = L"HOMEDRIVE";
const wchar_t kHomePath[] = L"HOMEPATH";
@@ -77,27 +66,6 @@
remoting::ChromotingHostContext context;
context.Start();
- scoped_ptr<remoting::Capturer> capturer;
- scoped_ptr<remoting::protocol::InputStub> input_stub;
-#if defined(OS_WIN)
- capturer.reset(new remoting::CapturerGdi(
- context.capture_message_loop()));
- input_stub.reset(new remoting::EventExecutorWin(
- context.capture_message_loop(), capturer.get()));
-#elif defined(OS_LINUX)
- capturer.reset(new remoting::CapturerLinux(
- context.capture_message_loop()));
- input_stub.reset(new remoting::EventExecutorLinux(
- context.capture_message_loop(), capturer.get()));
-#elif defined(OS_MACOSX)
- capturer.reset(new remoting::CapturerMac(
- context.capture_message_loop()));
- 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.
- bool fake = cmd_line->HasSwitch(kFakeSwitchName);
#if defined(OS_WIN)
std::wstring home_path = GetEnvironmentVar(kHomeDrive);
@@ -111,12 +79,6 @@
config_path = cmd_line->GetSwitchValuePath(kConfigSwitchName);
}
- if (fake) {
- // Inject a fake capturer.
- LOG(INFO) << "Using a fake capturer.";
- capturer.reset(new remoting::CapturerFake(context.capture_message_loop()));
- }
-
base::Thread file_io_thread("FileIO");
file_io_thread.Start();
@@ -136,11 +98,16 @@
<< "Cannot load media library";
// Construct a chromoting host.
- scoped_refptr<remoting::ChromotingHost> host(
- new remoting::ChromotingHost(&context,
- config,
- capturer.release(),
- input_stub.release()));
+ scoped_refptr<remoting::ChromotingHost> host;
+
+ bool fake = cmd_line->HasSwitch(kFakeSwitchName);
+ if (fake) {
+ host = new remoting::ChromotingHost(
+ &context, config,
+ new remoting::CapturerFake(context.capture_message_loop()));
+ } else {
+ host = new remoting::ChromotingHost(&context, config);
+ }
// Let the chromoting host run until the shutdown task is executed.
MessageLoop message_loop(MessageLoop::TYPE_UI);