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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 } // namespace | 88 } // namespace |
89 | 89 |
90 namespace remoting { | 90 namespace remoting { |
91 | 91 |
92 class SimpleHost { | 92 class SimpleHost { |
93 public: | 93 public: |
94 SimpleHost() | 94 SimpleHost() |
95 : message_loop_(MessageLoop::TYPE_UI), | 95 : message_loop_(MessageLoop::TYPE_UI), |
96 file_io_thread_("FileIO"), | 96 file_io_thread_("FileIO"), |
97 context_(message_loop_.message_loop_proxy()), | 97 context_(NULL, message_loop_.message_loop_proxy()), |
98 fake_(false), | 98 fake_(false), |
99 is_it2me_(false) { | 99 is_it2me_(false) { |
100 context_.Start(); | 100 context_.Start(); |
101 file_io_thread_.Start(); | 101 file_io_thread_.Start(); |
102 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | 102 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
103 } | 103 } |
104 | 104 |
105 int Run() { | 105 int Run() { |
106 FilePath config_path = GetConfigPath(); | 106 FilePath config_path = GetConfigPath(); |
107 scoped_refptr<JsonHostConfig> config = new JsonHostConfig( | 107 scoped_refptr<JsonHostConfig> config = new JsonHostConfig( |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 #endif | 208 #endif |
209 } | 209 } |
210 | 210 |
211 void StartHost() { | 211 void StartHost() { |
212 signal_strategy_.reset( | 212 signal_strategy_.reset( |
213 new XmppSignalStrategy(context_.jingle_thread(), xmpp_login_, | 213 new XmppSignalStrategy(context_.jingle_thread(), xmpp_login_, |
214 xmpp_auth_token_, xmpp_auth_service_)); | 214 xmpp_auth_token_, xmpp_auth_service_)); |
215 signaling_connector_.reset(new SignalingConnector(signal_strategy_.get())); | 215 signaling_connector_.reset(new SignalingConnector(signal_strategy_.get())); |
216 | 216 |
217 if (fake_) { | 217 if (fake_) { |
218 Capturer* capturer = new CapturerFake(); | 218 scoped_ptr<Capturer> capturer(new CapturerFake()); |
219 EventExecutor* event_executor = | 219 scoped_ptr<protocol::InputStub> event_executor = |
220 EventExecutor::Create(context_.desktop_message_loop(), capturer); | 220 EventExecutor::Create( |
221 desktop_environment_.reset( | 221 context_.desktop_message_loop(), capturer.get()); |
222 new DesktopEnvironment(&context_, capturer, event_executor)); | 222 desktop_environment_ = DesktopEnvironment::CreateFake( |
| 223 &context_, capturer.Pass(), event_executor.Pass()); |
223 } else { | 224 } else { |
224 desktop_environment_.reset(DesktopEnvironment::Create(&context_)); | 225 desktop_environment_ = DesktopEnvironment::Create(&context_); |
225 } | 226 } |
226 | 227 |
227 host_ = new ChromotingHost(&context_, signal_strategy_.get(), | 228 host_ = new ChromotingHost(&context_, signal_strategy_.get(), |
228 desktop_environment_.get(), network_settings_); | 229 desktop_environment_.get(), network_settings_); |
229 | 230 |
230 ServerLogEntry::Mode mode = | 231 ServerLogEntry::Mode mode = |
231 is_it2me_ ? ServerLogEntry::IT2ME : ServerLogEntry::ME2ME; | 232 is_it2me_ ? ServerLogEntry::IT2ME : ServerLogEntry::ME2ME; |
232 log_to_server_.reset(new LogToServer(host_, mode, signal_strategy_.get())); | 233 log_to_server_.reset(new LogToServer(host_, mode, signal_strategy_.get())); |
233 | 234 |
234 if (is_it2me_) { | 235 if (is_it2me_) { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 max_port < 0 || max_port > 65535) { | 371 max_port < 0 || max_port > 65535) { |
371 LOG(ERROR) << "Invalid max-port value: " << max_port | 372 LOG(ERROR) << "Invalid max-port value: " << max_port |
372 << ". Expected integer in range [0, 65535]."; | 373 << ". Expected integer in range [0, 65535]."; |
373 return 1; | 374 return 1; |
374 } | 375 } |
375 simple_host.network_settings()->max_port = max_port; | 376 simple_host.network_settings()->max_port = max_port; |
376 } | 377 } |
377 | 378 |
378 return simple_host.Run(); | 379 return simple_host.Run(); |
379 } | 380 } |
OLD | NEW |