| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 bool successful, | 153 bool successful, |
| 154 const std::string& support_id, | 154 const std::string& support_id, |
| 155 const base::TimeDelta& lifetime) { | 155 const base::TimeDelta& lifetime) { |
| 156 if (successful) { | 156 if (successful) { |
| 157 std::string host_secret = GenerateSupportHostSecret(); | 157 std::string host_secret = GenerateSupportHostSecret(); |
| 158 std::string access_code = support_id + host_secret; | 158 std::string access_code = support_id + host_secret; |
| 159 std::cout << "Support id: " << access_code << std::endl; | 159 std::cout << "Support id: " << access_code << std::endl; |
| 160 | 160 |
| 161 scoped_ptr<protocol::AuthenticatorFactory> factory( | 161 scoped_ptr<protocol::AuthenticatorFactory> factory( |
| 162 new protocol::It2MeHostAuthenticatorFactory( | 162 new protocol::It2MeHostAuthenticatorFactory( |
| 163 key_pair->GenerateCertificate(), key_pair->private_key(), | 163 key_pair->GenerateCertificate(), *key_pair->private_key(), |
| 164 access_code)); | 164 access_code)); |
| 165 host->SetAuthenticatorFactory(factory.Pass()); | 165 host->SetAuthenticatorFactory(factory.Pass()); |
| 166 } else { | 166 } else { |
| 167 LOG(ERROR) << "If you haven't done so recently, try running" | 167 LOG(ERROR) << "If you haven't done so recently, try running" |
| 168 << " remoting/tools/register_host.py."; | 168 << " remoting/tools/register_host.py."; |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 FilePath GetConfigPath() { | 172 FilePath GetConfigPath() { |
| 173 if (!config_path_.empty()) | 173 if (!config_path_.empty()) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 host_->Start(); | 236 host_->Start(); |
| 237 | 237 |
| 238 // Create a Me2Me authenticator factory. | 238 // Create a Me2Me authenticator factory. |
| 239 // | 239 // |
| 240 // TODO(sergeyu): Currently empty PIN is used. This is a temporary | 240 // TODO(sergeyu): Currently empty PIN is used. This is a temporary |
| 241 // hack pending us adding a way to set a PIN. crbug.com/105214 . | 241 // hack pending us adding a way to set a PIN. crbug.com/105214 . |
| 242 if (!is_it2me_) { | 242 if (!is_it2me_) { |
| 243 scoped_ptr<protocol::AuthenticatorFactory> factory( | 243 scoped_ptr<protocol::AuthenticatorFactory> factory( |
| 244 new protocol::Me2MeHostAuthenticatorFactory( | 244 new protocol::Me2MeHostAuthenticatorFactory( |
| 245 xmpp_login_, key_pair_.GenerateCertificate(), | 245 xmpp_login_, key_pair_.GenerateCertificate(), |
| 246 key_pair_.private_key(), "")); | 246 *key_pair_.private_key(), "")); |
| 247 host_->SetAuthenticatorFactory(factory.Pass()); | 247 host_->SetAuthenticatorFactory(factory.Pass()); |
| 248 } | 248 } |
| 249 } | 249 } |
| 250 | 250 |
| 251 MessageLoop message_loop_; | 251 MessageLoop message_loop_; |
| 252 base::Thread file_io_thread_; | 252 base::Thread file_io_thread_; |
| 253 ChromotingHostContext context_; | 253 ChromotingHostContext context_; |
| 254 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; | 254 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; |
| 255 | 255 |
| 256 FilePath config_path_; | 256 FilePath config_path_; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 LOG(ERROR) << "Unknown video codec: " << video_codec; | 323 LOG(ERROR) << "Unknown video codec: " << video_codec; |
| 324 return 1; | 324 return 1; |
| 325 } | 325 } |
| 326 config->mutable_video_configs()->push_back(ChannelConfig( | 326 config->mutable_video_configs()->push_back(ChannelConfig( |
| 327 transport, remoting::protocol::kDefaultStreamVersion, codec)); | 327 transport, remoting::protocol::kDefaultStreamVersion, codec)); |
| 328 simple_host.set_protocol_config(config.release()); | 328 simple_host.set_protocol_config(config.release()); |
| 329 } | 329 } |
| 330 | 330 |
| 331 return simple_host.Run(); | 331 return simple_host.Run(); |
| 332 } | 332 } |
| OLD | NEW |