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 file implements a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 int* exit_code_out) | 324 int* exit_code_out) |
325 : context_(context.Pass()), | 325 : context_(context.Pass()), |
326 state_(HOST_INITIALIZING), | 326 state_(HOST_INITIALIZING), |
327 allow_nat_traversal_(true), | 327 allow_nat_traversal_(true), |
328 curtain_required_(false), | 328 curtain_required_(false), |
329 #if defined(REMOTING_MULTI_PROCESS) | 329 #if defined(REMOTING_MULTI_PROCESS) |
330 desktop_session_connector_(NULL), | 330 desktop_session_connector_(NULL), |
331 #endif // defined(REMOTING_MULTI_PROCESS) | 331 #endif // defined(REMOTING_MULTI_PROCESS) |
332 ALLOW_THIS_IN_INITIALIZER_LIST(self_(this)), | 332 ALLOW_THIS_IN_INITIALIZER_LIST(self_(this)), |
333 exit_code_out_(exit_code_out) { | 333 exit_code_out_(exit_code_out) { |
334 // Create a NetworkChangeNotifier for use by the signalling connector. | |
335 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | |
336 | |
337 // Create the platform-specific curtain-mode implementation. | 334 // Create the platform-specific curtain-mode implementation. |
338 // TODO(wez): Create this on the network thread? | 335 // TODO(wez): Create this on the network thread? |
339 curtain_ = CurtainMode::Create( | 336 curtain_ = CurtainMode::Create( |
340 base::Bind(&HostProcess::OnRemoteSessionSwitchedToConsole, | 337 base::Bind(&HostProcess::OnRemoteSessionSwitchedToConsole, |
341 base::Unretained(this)), | 338 base::Unretained(this)), |
342 base::Bind(&HostProcess::OnCurtainModeFailed, | 339 base::Bind(&HostProcess::OnCurtainModeFailed, |
343 base::Unretained(this))); | 340 base::Unretained(this))); |
344 | 341 |
345 StartOnUiThread(); | 342 StartOnUiThread(); |
346 } | 343 } |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 | 903 |
907 signal_strategy_.reset( | 904 signal_strategy_.reset( |
908 new XmppSignalStrategy(context_->url_request_context_getter(), | 905 new XmppSignalStrategy(context_->url_request_context_getter(), |
909 xmpp_login_, xmpp_auth_token_, | 906 xmpp_login_, xmpp_auth_token_, |
910 xmpp_auth_service_, xmpp_server_config_)); | 907 xmpp_auth_service_, xmpp_server_config_)); |
911 | 908 |
912 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker( | 909 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker( |
913 new DnsBlackholeChecker(context_->url_request_context_getter(), | 910 new DnsBlackholeChecker(context_->url_request_context_getter(), |
914 talkgadget_prefix_)); | 911 talkgadget_prefix_)); |
915 | 912 |
| 913 // Create a NetworkChangeNotifier for use by the signaling connector. |
| 914 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
| 915 |
916 signaling_connector_.reset(new SignalingConnector( | 916 signaling_connector_.reset(new SignalingConnector( |
917 signal_strategy_.get(), | 917 signal_strategy_.get(), |
918 context_->url_request_context_getter(), | 918 context_->url_request_context_getter(), |
919 dns_blackhole_checker.Pass(), | 919 dns_blackhole_checker.Pass(), |
920 base::Bind(&HostProcess::OnAuthFailed, this))); | 920 base::Bind(&HostProcess::OnAuthFailed, this))); |
921 | 921 |
922 if (!oauth_refresh_token_.empty()) { | 922 if (!oauth_refresh_token_.empty()) { |
923 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials( | 923 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials( |
924 new SignalingConnector::OAuthCredentials( | 924 new SignalingConnector::OAuthCredentials( |
925 xmpp_login_, oauth_refresh_token_)); | 925 xmpp_login_, oauth_refresh_token_)); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 1065 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
1066 | 1066 |
1067 host_ = NULL; | 1067 host_ = NULL; |
1068 curtaining_host_observer_.reset(); | 1068 curtaining_host_observer_.reset(); |
1069 host_event_logger_.reset(); | 1069 host_event_logger_.reset(); |
1070 log_to_server_.reset(); | 1070 log_to_server_.reset(); |
1071 heartbeat_sender_.reset(); | 1071 heartbeat_sender_.reset(); |
1072 host_change_notification_listener_.reset(); | 1072 host_change_notification_listener_.reset(); |
1073 signaling_connector_.reset(); | 1073 signaling_connector_.reset(); |
1074 signal_strategy_.reset(); | 1074 signal_strategy_.reset(); |
| 1075 network_change_notifier_.reset(); |
1075 | 1076 |
1076 if (state_ == HOST_STOPPING_TO_RESTART) { | 1077 if (state_ == HOST_STOPPING_TO_RESTART) { |
1077 StartHost(); | 1078 StartHost(); |
1078 } else if (state_ == HOST_STOPPING) { | 1079 } else if (state_ == HOST_STOPPING) { |
1079 state_ = HOST_STOPPED; | 1080 state_ = HOST_STOPPED; |
1080 | 1081 |
1081 if (policy_watcher_.get()) { | 1082 if (policy_watcher_.get()) { |
1082 base::WaitableEvent done_event(true, false); | 1083 base::WaitableEvent done_event(true, false); |
1083 policy_watcher_->StopWatching(&done_event); | 1084 policy_watcher_->StopWatching(&done_event); |
1084 done_event.Wait(); | 1085 done_event.Wait(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 return exit_code; | 1145 return exit_code; |
1145 } | 1146 } |
1146 | 1147 |
1147 } // namespace remoting | 1148 } // namespace remoting |
1148 | 1149 |
1149 #if !defined(OS_WIN) | 1150 #if !defined(OS_WIN) |
1150 int main(int argc, char** argv) { | 1151 int main(int argc, char** argv) { |
1151 return remoting::HostMain(argc, argv); | 1152 return remoting::HostMain(argc, argv); |
1152 } | 1153 } |
1153 #endif // !defined(OS_WIN) | 1154 #endif // !defined(OS_WIN) |
OLD | NEW |