Chromium Code Reviews| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 bool OnNatPolicyUpdate(bool nat_traversal_enabled); | 205 bool OnNatPolicyUpdate(bool nat_traversal_enabled); |
| 206 bool OnCurtainPolicyUpdate(bool curtain_required); | 206 bool OnCurtainPolicyUpdate(bool curtain_required); |
| 207 bool OnHostTalkGadgetPrefixPolicyUpdate(const std::string& talkgadget_prefix); | 207 bool OnHostTalkGadgetPrefixPolicyUpdate(const std::string& talkgadget_prefix); |
| 208 | 208 |
| 209 void StartHostStatusService(); | 209 void StartHostStatusService(); |
| 210 | 210 |
| 211 void StartHost(); | 211 void StartHost(); |
| 212 | 212 |
| 213 void OnAuthFailed(); | 213 void OnAuthFailed(); |
| 214 | 214 |
| 215 void RejectAuthenticatingClient(); | 215 void OnCurtainModeFailed(); |
| 216 | |
| 217 void OnRemoteSessionSwitchedToConsole(); | |
| 216 | 218 |
| 217 // Invoked when the user uses the Disconnect windows to terminate | 219 // Invoked when the user uses the Disconnect windows to terminate |
| 218 // the sessions, or when the local session is activated in curtain mode. | 220 // the sessions, or when the local session is activated in curtain mode. |
| 219 void OnDisconnectRequested(); | 221 void OnDisconnectRequested(); |
| 220 | 222 |
| 221 void RestartHost(); | 223 void RestartHost(); |
| 222 | 224 |
| 223 void RestartOnHostShutdown(); | 225 void RestartOnHostShutdown(); |
| 224 | 226 |
| 225 void Shutdown(int exit_code); | 227 void Shutdown(int exit_code); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 desktop_session_connector_(NULL), | 307 desktop_session_connector_(NULL), |
| 306 #endif // defined(REMOTING_MULTI_PROCESS) | 308 #endif // defined(REMOTING_MULTI_PROCESS) |
| 307 ALLOW_THIS_IN_INITIALIZER_LIST(self_(this)), | 309 ALLOW_THIS_IN_INITIALIZER_LIST(self_(this)), |
| 308 exit_code_out_(exit_code_out) { | 310 exit_code_out_(exit_code_out) { |
| 309 // Create a NetworkChangeNotifier for use by the signalling connector. | 311 // Create a NetworkChangeNotifier for use by the signalling connector. |
| 310 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | 312 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
| 311 | 313 |
| 312 // Create the platform-specific curtain-mode implementation. | 314 // Create the platform-specific curtain-mode implementation. |
| 313 // TODO(wez): Create this on the network thread? | 315 // TODO(wez): Create this on the network thread? |
| 314 curtain_ = CurtainMode::Create( | 316 curtain_ = CurtainMode::Create( |
| 315 base::Bind(&HostProcess::OnDisconnectRequested, | 317 base::Bind(&HostProcess::OnRemoteSessionSwitchedToConsole, |
| 316 base::Unretained(this)), | 318 base::Unretained(this)), |
| 317 base::Bind(&HostProcess::RejectAuthenticatingClient, | 319 base::Bind(&HostProcess::OnCurtainModeFailed, |
| 318 base::Unretained(this))); | 320 base::Unretained(this))); |
| 319 | 321 |
| 320 StartOnUiThread(); | 322 StartOnUiThread(); |
| 321 } | 323 } |
| 322 | 324 |
| 323 HostProcess::~HostProcess() { | 325 HostProcess::~HostProcess() { |
| 324 // Verify that UI components have been torn down. | 326 // Verify that UI components have been torn down. |
| 325 DCHECK(!config_watcher_); | 327 DCHECK(!config_watcher_); |
| 326 DCHECK(!daemon_channel_); | 328 DCHECK(!daemon_channel_); |
| 327 DCHECK(!desktop_environment_factory_); | 329 DCHECK(!desktop_environment_factory_); |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 926 | 928 |
| 927 host_->Start(xmpp_login_); | 929 host_->Start(xmpp_login_); |
| 928 | 930 |
| 929 CreateAuthenticatorFactory(); | 931 CreateAuthenticatorFactory(); |
| 930 } | 932 } |
| 931 | 933 |
| 932 void HostProcess::OnAuthFailed() { | 934 void HostProcess::OnAuthFailed() { |
| 933 Shutdown(kInvalidOauthCredentialsExitCode); | 935 Shutdown(kInvalidOauthCredentialsExitCode); |
| 934 } | 936 } |
| 935 | 937 |
| 936 void HostProcess::RejectAuthenticatingClient() { | 938 void HostProcess::OnCurtainModeFailed() { |
| 937 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 939 LOG(ERROR) << "Curtain mode failed to activate. Closing connection."; |
| 938 DCHECK(host_); | 940 OnDisconnectRequested(); |
| 939 host_->RejectAuthenticatingClient(); | 941 } |
|
Jamie
2012/11/28 23:52:32
There's a comment on this method saying that it sh
rmsousa
2012/11/29 00:11:14
Right now this is only called when activating the
Jamie
2012/11/29 01:05:58
which is
Sergey Ulanov
2012/11/30 01:09:39
+1. A message that says "maybe your entered incorr
| |
| 942 | |
| 943 void HostProcess::OnRemoteSessionSwitchedToConsole() { | |
| 944 LOG(INFO) << "The remote session switched was to the console." | |
| 945 << " Closing connection."; | |
| 946 OnDisconnectRequested(); | |
| 940 } | 947 } |
| 941 | 948 |
| 942 // Invoked when the user uses the Disconnect windows to terminate | 949 // Invoked when the user uses the Disconnect windows to terminate |
| 943 // the sessions, or when the local session is activated in curtain mode. | 950 // the sessions, or when the local session is activated in curtain mode. |
| 944 void HostProcess::OnDisconnectRequested() { | 951 void HostProcess::OnDisconnectRequested() { |
| 945 if (!context_->network_task_runner()->BelongsToCurrentThread()) { | 952 if (!context_->network_task_runner()->BelongsToCurrentThread()) { |
| 946 context_->network_task_runner()->PostTask(FROM_HERE, | 953 context_->network_task_runner()->PostTask(FROM_HERE, |
| 947 base::Bind(&HostProcess::OnDisconnectRequested, this)); | 954 base::Bind(&HostProcess::OnDisconnectRequested, this)); |
| 948 return; | 955 return; |
| 949 } | 956 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1122 user32.GetFunctionPointer("SetProcessDPIAware")); | 1129 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 1123 set_process_dpi_aware(); | 1130 set_process_dpi_aware(); |
| 1124 } | 1131 } |
| 1125 | 1132 |
| 1126 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 1133 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 1127 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 1134 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 1128 return main(0, NULL); | 1135 return main(0, NULL); |
| 1129 } | 1136 } |
| 1130 | 1137 |
| 1131 #endif // defined(OS_WIN) | 1138 #endif // defined(OS_WIN) |
| OLD | NEW |