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 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
938 DCHECK(host_); | 940 DCHECK(host_); |
941 LOG(ERROR) << "Curtain mode failed to activate. Closing connection."; | |
939 host_->RejectAuthenticatingClient(); | 942 host_->RejectAuthenticatingClient(); |
940 } | 943 } |
941 | 944 |
945 void HostProcess::OnRemoteSessionSwitchedToConsole() { | |
946 LOG(INFO) << "The remote session switched was to the console." | |
947 << " Closing connection."; | |
Sergey Ulanov
2012/11/30 01:09:39
nit: indentation. You can also remove "<<" here.
Jamie
2012/11/30 02:24:24
Done.
| |
948 OnDisconnectRequested(); | |
949 } | |
950 | |
942 // Invoked when the user uses the Disconnect windows to terminate | 951 // Invoked when the user uses the Disconnect windows to terminate |
943 // the sessions, or when the local session is activated in curtain mode. | 952 // the sessions, or when the local session is activated in curtain mode. |
944 void HostProcess::OnDisconnectRequested() { | 953 void HostProcess::OnDisconnectRequested() { |
945 if (!context_->network_task_runner()->BelongsToCurrentThread()) { | 954 if (!context_->network_task_runner()->BelongsToCurrentThread()) { |
946 context_->network_task_runner()->PostTask(FROM_HERE, | 955 context_->network_task_runner()->PostTask(FROM_HERE, |
947 base::Bind(&HostProcess::OnDisconnectRequested, this)); | 956 base::Bind(&HostProcess::OnDisconnectRequested, this)); |
948 return; | 957 return; |
949 } | 958 } |
950 if (host_) { | 959 if (host_) { |
951 host_->DisconnectAllClients(); | 960 host_->DisconnectAllClients(); |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1122 user32.GetFunctionPointer("SetProcessDPIAware")); | 1131 user32.GetFunctionPointer("SetProcessDPIAware")); |
1123 set_process_dpi_aware(); | 1132 set_process_dpi_aware(); |
1124 } | 1133 } |
1125 | 1134 |
1126 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 1135 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
1127 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 1136 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
1128 return main(0, NULL); | 1137 return main(0, NULL); |
1129 } | 1138 } |
1130 | 1139 |
1131 #endif // defined(OS_WIN) | 1140 #endif // defined(OS_WIN) |
OLD | NEW |