| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This is an application of a minimal host process in a Chromoting | 5 // This is an application of a minimal host process in a Chromoting |
| 6 // system. It serves the purpose of gluing different pieces together | 6 // system. It serves the purpose of gluing different pieces together |
| 7 // to make a functional host process for testing. | 7 // to make a functional host process for testing. |
| 8 // | 8 // |
| 9 // It peforms the following functionality: | 9 // It peforms the following functionality: |
| 10 // 1. Connect to the GTalk network and register the machine as a host. | 10 // 1. Connect to the GTalk network and register the machine as a host. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 #include "remoting/base/auto_thread_task_runner.h" | 35 #include "remoting/base/auto_thread_task_runner.h" |
| 36 #include "remoting/base/constants.h" | 36 #include "remoting/base/constants.h" |
| 37 #include "remoting/host/audio_capturer.h" | 37 #include "remoting/host/audio_capturer.h" |
| 38 #include "remoting/host/chromoting_host_context.h" | 38 #include "remoting/host/chromoting_host_context.h" |
| 39 #include "remoting/host/chromoting_host.h" | 39 #include "remoting/host/chromoting_host.h" |
| 40 #include "remoting/host/desktop_environment.h" | 40 #include "remoting/host/desktop_environment.h" |
| 41 #include "remoting/host/desktop_environment.h" | 41 #include "remoting/host/desktop_environment.h" |
| 42 #include "remoting/host/desktop_environment_factory.h" | 42 #include "remoting/host/desktop_environment_factory.h" |
| 43 #include "remoting/host/dns_blackhole_checker.h" | 43 #include "remoting/host/dns_blackhole_checker.h" |
| 44 #include "remoting/host/event_executor.h" | 44 #include "remoting/host/event_executor.h" |
| 45 #include "remoting/host/event_executor_fake.h" |
| 45 #include "remoting/host/heartbeat_sender.h" | 46 #include "remoting/host/heartbeat_sender.h" |
| 46 #include "remoting/host/host_exit_codes.h" | 47 #include "remoting/host/host_exit_codes.h" |
| 47 #include "remoting/host/host_key_pair.h" | 48 #include "remoting/host/host_key_pair.h" |
| 48 #include "remoting/host/host_secret.h" | 49 #include "remoting/host/host_secret.h" |
| 49 #include "remoting/host/it2me_host_user_interface.h" | 50 #include "remoting/host/it2me_host_user_interface.h" |
| 50 #include "remoting/host/json_host_config.h" | 51 #include "remoting/host/json_host_config.h" |
| 51 #include "remoting/host/log_to_server.h" | 52 #include "remoting/host/log_to_server.h" |
| 52 #include "remoting/host/network_settings.h" | 53 #include "remoting/host/network_settings.h" |
| 53 #include "remoting/host/register_support_host_request.h" | 54 #include "remoting/host/register_support_host_request.h" |
| 54 #include "remoting/host/session_manager_factory.h" | 55 #include "remoting/host/session_manager_factory.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 95 |
| 95 } // namespace | 96 } // namespace |
| 96 | 97 |
| 97 namespace remoting { | 98 namespace remoting { |
| 98 | 99 |
| 99 class FakeDesktopEnvironmentFactory : public DesktopEnvironmentFactory { | 100 class FakeDesktopEnvironmentFactory : public DesktopEnvironmentFactory { |
| 100 public: | 101 public: |
| 101 FakeDesktopEnvironmentFactory(); | 102 FakeDesktopEnvironmentFactory(); |
| 102 virtual ~FakeDesktopEnvironmentFactory(); | 103 virtual ~FakeDesktopEnvironmentFactory(); |
| 103 | 104 |
| 104 virtual scoped_ptr<DesktopEnvironment> Create( | 105 virtual scoped_ptr<DesktopEnvironment> Create() OVERRIDE; |
| 105 ChromotingHostContext* context) OVERRIDE; | |
| 106 | 106 |
| 107 private: |
| 107 DISALLOW_COPY_AND_ASSIGN(FakeDesktopEnvironmentFactory); | 108 DISALLOW_COPY_AND_ASSIGN(FakeDesktopEnvironmentFactory); |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 FakeDesktopEnvironmentFactory::FakeDesktopEnvironmentFactory() { | 111 FakeDesktopEnvironmentFactory::FakeDesktopEnvironmentFactory() |
| 112 : DesktopEnvironmentFactory(NULL, NULL) { |
| 111 } | 113 } |
| 112 | 114 |
| 113 FakeDesktopEnvironmentFactory::~FakeDesktopEnvironmentFactory() { | 115 FakeDesktopEnvironmentFactory::~FakeDesktopEnvironmentFactory() { |
| 114 } | 116 } |
| 115 | 117 |
| 116 scoped_ptr<DesktopEnvironment> FakeDesktopEnvironmentFactory::Create( | 118 scoped_ptr<DesktopEnvironment> FakeDesktopEnvironmentFactory::Create() { |
| 117 ChromotingHostContext* context) { | |
| 118 scoped_ptr<VideoFrameCapturer> capturer(new VideoFrameCapturerFake()); | 119 scoped_ptr<VideoFrameCapturer> capturer(new VideoFrameCapturerFake()); |
| 119 scoped_ptr<EventExecutor> event_executor = EventExecutor::Create( | 120 scoped_ptr<EventExecutor> event_executor(new EventExecutorFake()); |
| 120 context->desktop_task_runner(), | |
| 121 context->ui_task_runner()); | |
| 122 scoped_ptr<AudioCapturer> audio_capturer(NULL); | |
| 123 return scoped_ptr<DesktopEnvironment>(new DesktopEnvironment( | 121 return scoped_ptr<DesktopEnvironment>(new DesktopEnvironment( |
| 124 audio_capturer.Pass(), | 122 scoped_ptr<AudioCapturer>(NULL), |
| 125 event_executor.Pass(), | 123 event_executor.Pass(), |
| 126 capturer.Pass())); | 124 capturer.Pass())); |
| 127 } | 125 } |
| 128 | 126 |
| 129 class SimpleHost : public HeartbeatSender::Listener { | 127 class SimpleHost : public HeartbeatSender::Listener { |
| 130 public: | 128 public: |
| 131 SimpleHost() | 129 SimpleHost() |
| 132 : message_loop_(MessageLoop::TYPE_UI), | 130 : message_loop_(MessageLoop::TYPE_UI), |
| 133 context_(new AutoThreadTaskRunner(message_loop_.message_loop_proxy())), | 131 context_(new AutoThreadTaskRunner(message_loop_.message_loop_proxy())), |
| 134 fake_(false), | 132 fake_(false), |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 xmpp_login_, xmpp_auth_token_, xmpp_auth_service_)); | 254 xmpp_login_, xmpp_auth_token_, xmpp_auth_service_)); |
| 257 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker( | 255 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker( |
| 258 new DnsBlackholeChecker(&context_, kDefaultHostTalkGadgetPrefix)); | 256 new DnsBlackholeChecker(&context_, kDefaultHostTalkGadgetPrefix)); |
| 259 signaling_connector_.reset(new SignalingConnector( | 257 signaling_connector_.reset(new SignalingConnector( |
| 260 signal_strategy_.get(), &context_, dns_blackhole_checker.Pass(), | 258 signal_strategy_.get(), &context_, dns_blackhole_checker.Pass(), |
| 261 base::Bind(&SimpleHost::OnAuthFailed, base::Unretained(this)))); | 259 base::Bind(&SimpleHost::OnAuthFailed, base::Unretained(this)))); |
| 262 | 260 |
| 263 if (fake_) { | 261 if (fake_) { |
| 264 desktop_environment_factory_.reset(new FakeDesktopEnvironmentFactory()); | 262 desktop_environment_factory_.reset(new FakeDesktopEnvironmentFactory()); |
| 265 } else { | 263 } else { |
| 266 desktop_environment_factory_.reset(new DesktopEnvironmentFactory()); | 264 desktop_environment_factory_.reset(new DesktopEnvironmentFactory( |
| 265 context_.input_task_runner(), context_.ui_task_runner())); |
| 267 } | 266 } |
| 268 | 267 |
| 269 host_ = new ChromotingHost( | 268 host_ = new ChromotingHost( |
| 270 &context_, signal_strategy_.get(), desktop_environment_factory_.get(), | 269 signal_strategy_.get(), desktop_environment_factory_.get(), |
| 271 CreateHostSessionManager(network_settings_, | 270 CreateHostSessionManager(network_settings_, |
| 272 context_.url_request_context_getter())); | 271 context_.url_request_context_getter()), |
| 272 context_.capture_task_runner(), |
| 273 context_.encode_task_runner(), |
| 274 context_.network_task_runner()); |
| 273 | 275 |
| 274 ServerLogEntry::Mode mode = | 276 ServerLogEntry::Mode mode = |
| 275 is_it2me_ ? ServerLogEntry::IT2ME : ServerLogEntry::ME2ME; | 277 is_it2me_ ? ServerLogEntry::IT2ME : ServerLogEntry::ME2ME; |
| 276 log_to_server_.reset(new LogToServer(host_, mode, signal_strategy_.get())); | 278 log_to_server_.reset(new LogToServer(host_, mode, signal_strategy_.get())); |
| 277 | 279 |
| 278 if (is_it2me_) { | 280 if (is_it2me_) { |
| 279 it2me_host_user_interface_.reset(new It2MeHostUserInterface(&context_)); | 281 it2me_host_user_interface_.reset(new It2MeHostUserInterface(&context_)); |
| 280 it2me_host_user_interface_->Start( | 282 it2me_host_user_interface_->Start( |
| 281 host_, | 283 host_, |
| 282 base::Bind(&ChromotingHost::Shutdown, host_, base::Closure())); | 284 base::Bind(&ChromotingHost::Shutdown, host_, base::Closure())); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 max_port < 0 || max_port > 65535) { | 463 max_port < 0 || max_port > 65535) { |
| 462 LOG(ERROR) << "Invalid max-port value: " << max_port | 464 LOG(ERROR) << "Invalid max-port value: " << max_port |
| 463 << ". Expected integer in range [0, 65535]."; | 465 << ". Expected integer in range [0, 65535]."; |
| 464 return 1; | 466 return 1; |
| 465 } | 467 } |
| 466 simple_host.network_settings()->max_port = max_port; | 468 simple_host.network_settings()->max_port = max_port; |
| 467 } | 469 } |
| 468 | 470 |
| 469 return simple_host.Run(); | 471 return simple_host.Run(); |
| 470 } | 472 } |
| OLD | NEW |