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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const char kVideoSwitchValueVp8Rtp[] = "vp8rtp"; | 86 const char kVideoSwitchValueVp8Rtp[] = "vp8rtp"; |
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 context_(message_loop_.message_loop_proxy()), |
97 context_(NULL, message_loop_.message_loop_proxy()), | |
98 fake_(false), | 97 fake_(false), |
99 is_it2me_(false) { | 98 is_it2me_(false) { |
100 context_.Start(); | 99 context_.Start(); |
101 file_io_thread_.Start(); | |
102 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | 100 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
103 } | 101 } |
104 | 102 |
105 int Run() { | 103 int Run() { |
106 FilePath config_path = GetConfigPath(); | 104 FilePath config_path = GetConfigPath(); |
107 JsonHostConfig config(config_path); | 105 JsonHostConfig config(config_path); |
108 if (!config.Read()) { | 106 if (!config.Read()) { |
109 LOG(ERROR) << "Failed to read configuration file " | 107 LOG(ERROR) << "Failed to read configuration file " |
110 << config_path.value(); | 108 << config_path.value(); |
111 return 1; | 109 return 1; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 if (!is_it2me_) { | 254 if (!is_it2me_) { |
257 scoped_ptr<protocol::AuthenticatorFactory> factory( | 255 scoped_ptr<protocol::AuthenticatorFactory> factory( |
258 new protocol::Me2MeHostAuthenticatorFactory( | 256 new protocol::Me2MeHostAuthenticatorFactory( |
259 xmpp_login_, key_pair_.GenerateCertificate(), | 257 xmpp_login_, key_pair_.GenerateCertificate(), |
260 *key_pair_.private_key(), host_secret_hash_)); | 258 *key_pair_.private_key(), host_secret_hash_)); |
261 host_->SetAuthenticatorFactory(factory.Pass()); | 259 host_->SetAuthenticatorFactory(factory.Pass()); |
262 } | 260 } |
263 } | 261 } |
264 | 262 |
265 MessageLoop message_loop_; | 263 MessageLoop message_loop_; |
266 base::Thread file_io_thread_; | |
267 ChromotingHostContext context_; | 264 ChromotingHostContext context_; |
268 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 265 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
269 | 266 |
270 FilePath config_path_; | 267 FilePath config_path_; |
271 bool fake_; | 268 bool fake_; |
272 bool is_it2me_; | 269 bool is_it2me_; |
273 NetworkSettings network_settings_; | 270 NetworkSettings network_settings_; |
274 scoped_ptr<CandidateSessionConfig> protocol_config_; | 271 scoped_ptr<CandidateSessionConfig> protocol_config_; |
275 | 272 |
276 std::string host_id_; | 273 std::string host_id_; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 max_port < 0 || max_port > 65535) { | 367 max_port < 0 || max_port > 65535) { |
371 LOG(ERROR) << "Invalid max-port value: " << max_port | 368 LOG(ERROR) << "Invalid max-port value: " << max_port |
372 << ". Expected integer in range [0, 65535]."; | 369 << ". Expected integer in range [0, 65535]."; |
373 return 1; | 370 return 1; |
374 } | 371 } |
375 simple_host.network_settings()->max_port = max_port; | 372 simple_host.network_settings()->max_port = max_port; |
376 } | 373 } |
377 | 374 |
378 return simple_host.Run(); | 375 return simple_host.Run(); |
379 } | 376 } |
OLD | NEW |