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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 #else // !defined(OS_WIN) | 129 #else // !defined(OS_WIN) |
130 desktop_environment_factory_(new DesktopEnvironmentFactory( | 130 desktop_environment_factory_(new DesktopEnvironmentFactory( |
131 context_->input_task_runner(), context_->ui_task_runner())), | 131 context_->input_task_runner(), context_->ui_task_runner())), |
132 #endif // !defined(OS_WIN) | 132 #endif // !defined(OS_WIN) |
133 desktop_resizer_(DesktopResizer::Create()), | 133 desktop_resizer_(DesktopResizer::Create()), |
134 exit_code_(kSuccessExitCode) { | 134 exit_code_(kSuccessExitCode) { |
135 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | 135 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
136 curtain_ = CurtainMode::Create( | 136 curtain_ = CurtainMode::Create( |
137 base::Bind(&HostProcess::OnDisconnectRequested, | 137 base::Bind(&HostProcess::OnDisconnectRequested, |
138 base::Unretained(this)), | 138 base::Unretained(this)), |
139 base::Bind(&HostProcess::OnDisconnectRequested, | 139 base::Bind(&HostProcess::RejectAuthenticatingClient, |
140 base::Unretained(this))); | 140 base::Unretained(this))); |
141 } | 141 } |
142 | 142 |
143 #if defined(REMOTING_MULTI_PROCESS) | 143 #if defined(REMOTING_MULTI_PROCESS) |
144 | 144 |
145 bool InitWithCommandLine(const CommandLine* cmd_line) { | 145 bool InitWithCommandLine(const CommandLine* cmd_line) { |
146 // Parse the handle value and convert it to a handle/file descriptor. | 146 // Parse the handle value and convert it to a handle/file descriptor. |
147 std::string channel_name = | 147 std::string channel_name = |
148 cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName); | 148 cmd_line->GetSwitchValueASCII(kDaemonPipeSwitchName); |
149 | 149 |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
595 | 595 |
596 host_->Start(xmpp_login_); | 596 host_->Start(xmpp_login_); |
597 | 597 |
598 CreateAuthenticatorFactory(); | 598 CreateAuthenticatorFactory(); |
599 } | 599 } |
600 | 600 |
601 void OnAuthFailed() { | 601 void OnAuthFailed() { |
602 Shutdown(kInvalidOauthCredentialsExitCode); | 602 Shutdown(kInvalidOauthCredentialsExitCode); |
603 } | 603 } |
604 | 604 |
605 void RejectAuthenticatingClient() { | |
606 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | |
607 DCHECK(host_); | |
rmsousa
2012/10/17 01:03:55
Specifically, this must always be called from an O
| |
608 host_->RejectAuthenticatingClient(); | |
609 } | |
610 | |
605 // Invoked when the user uses the Disconnect windows to terminate | 611 // Invoked when the user uses the Disconnect windows to terminate |
606 // the sessions, or when the local session is activated in curtain mode. | 612 // the sessions, or when the local session is activated in curtain mode. |
607 void OnDisconnectRequested() { | 613 void OnDisconnectRequested() { |
608 if (!context_->network_task_runner()->BelongsToCurrentThread()) { | 614 if (!context_->network_task_runner()->BelongsToCurrentThread()) { |
609 context_->network_task_runner()->PostTask(FROM_HERE, base::Bind( | 615 context_->network_task_runner()->PostTask(FROM_HERE, base::Bind( |
610 &HostProcess::OnDisconnectRequested, base::Unretained(this))); | 616 &HostProcess::OnDisconnectRequested, base::Unretained(this))); |
611 return; | 617 return; |
612 } | 618 } |
613 if (host_) { | 619 if (host_) { |
614 host_->DisconnectAllClients(); | 620 host_->DisconnectAllClients(); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
829 user32.GetFunctionPointer("SetProcessDPIAware")); | 835 user32.GetFunctionPointer("SetProcessDPIAware")); |
830 set_process_dpi_aware(); | 836 set_process_dpi_aware(); |
831 } | 837 } |
832 | 838 |
833 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 839 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
834 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 840 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
835 return main(0, NULL); | 841 return main(0, NULL); |
836 } | 842 } |
837 | 843 |
838 #endif // defined(OS_WIN) | 844 #endif // defined(OS_WIN) |
OLD | NEW |