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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 std::string xmpp_login_; | 236 std::string xmpp_login_; |
237 std::string xmpp_auth_token_; | 237 std::string xmpp_auth_token_; |
238 std::string xmpp_auth_service_; | 238 std::string xmpp_auth_service_; |
239 | 239 |
240 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; | 240 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; |
241 bool allow_nat_traversal_; | 241 bool allow_nat_traversal_; |
242 std::string talkgadget_prefix_; | 242 std::string talkgadget_prefix_; |
243 | 243 |
244 scoped_ptr<CurtainMode> curtain_; | 244 scoped_ptr<CurtainMode> curtain_; |
245 scoped_ptr<CurtainingHostObserver> curtaining_host_observer_; | 245 scoped_ptr<CurtainingHostObserver> curtaining_host_observer_; |
246 bool curtain_required_; | |
246 | 247 |
247 bool restarting_; | 248 bool restarting_; |
248 bool shutting_down_; | 249 bool shutting_down_; |
249 | 250 |
250 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; | 251 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; |
251 scoped_ptr<DesktopResizer> desktop_resizer_; | 252 scoped_ptr<DesktopResizer> desktop_resizer_; |
252 scoped_ptr<ResizingHostObserver> resizing_host_observer_; | 253 scoped_ptr<ResizingHostObserver> resizing_host_observer_; |
253 scoped_ptr<XmppSignalStrategy> signal_strategy_; | 254 scoped_ptr<XmppSignalStrategy> signal_strategy_; |
254 scoped_ptr<SignalingConnector> signaling_connector_; | 255 scoped_ptr<SignalingConnector> signaling_connector_; |
255 scoped_ptr<HeartbeatSender> heartbeat_sender_; | 256 scoped_ptr<HeartbeatSender> heartbeat_sender_; |
256 scoped_ptr<LogToServer> log_to_server_; | 257 scoped_ptr<LogToServer> log_to_server_; |
257 scoped_ptr<HostEventLogger> host_event_logger_; | 258 scoped_ptr<HostEventLogger> host_event_logger_; |
258 | 259 |
259 scoped_ptr<HostUserInterface> host_user_interface_; | 260 scoped_ptr<HostUserInterface> host_user_interface_; |
260 | 261 |
261 scoped_refptr<ChromotingHost> host_; | 262 scoped_refptr<ChromotingHost> host_; |
262 | 263 |
263 #if defined(REMOTING_MULTI_PROCESS) | 264 #if defined(REMOTING_MULTI_PROCESS) |
264 DesktopSessionConnector* desktop_session_connector_; | 265 DesktopSessionConnector* desktop_session_connector_; |
265 #endif // defined(REMOTING_MULTI_PROCESS) | 266 #endif // defined(REMOTING_MULTI_PROCESS) |
266 | 267 |
267 int exit_code_; | 268 int exit_code_; |
268 }; | 269 }; |
269 | 270 |
270 HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context) | 271 HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context) |
271 : context_(context.Pass()), | 272 : context_(context.Pass()), |
272 allow_nat_traversal_(true), | 273 allow_nat_traversal_(true), |
274 curtain_required_(false), | |
273 restarting_(false), | 275 restarting_(false), |
274 shutting_down_(false), | 276 shutting_down_(false), |
275 desktop_resizer_(DesktopResizer::Create()), | 277 desktop_resizer_(DesktopResizer::Create()), |
276 #if defined(REMOTING_MULTI_PROCESS) | 278 #if defined(REMOTING_MULTI_PROCESS) |
277 desktop_session_connector_(NULL), | 279 desktop_session_connector_(NULL), |
278 #endif // defined(REMOTING_MULTI_PROCESS) | 280 #endif // defined(REMOTING_MULTI_PROCESS) |
279 exit_code_(kSuccessExitCode) { | 281 exit_code_(kSuccessExitCode) { |
280 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | 282 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
281 curtain_ = CurtainMode::Create( | 283 curtain_ = CurtainMode::Create( |
282 base::Bind(&HostProcess::OnDisconnectRequested, | 284 base::Bind(&HostProcess::OnDisconnectRequested, |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
703 LOG(INFO) << "Updated NAT policy."; | 705 LOG(INFO) << "Updated NAT policy."; |
704 return true; | 706 return true; |
705 } | 707 } |
706 return false; | 708 return false; |
707 } | 709 } |
708 | 710 |
709 bool HostProcess::OnCurtainPolicyUpdate(bool curtain_required) { | 711 bool HostProcess::OnCurtainPolicyUpdate(bool curtain_required) { |
710 // Returns true if the host has to be restarted after this policy update. | 712 // Returns true if the host has to be restarted after this policy update. |
711 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 713 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
712 | 714 |
713 #if defined(OS_MACOSX) | 715 if (curtain_required_ != curtain_required) { |
714 if (curtain_required) { | 716 curtain_required_ = curtain_required; |
715 // If curtain mode is required, then we can't currently support remoting | |
716 // the login screen. This is because we don't curtain the login screen | |
717 // and the current daemon architecture means that the connction is closed | |
718 // immediately after login, leaving the host system uncurtained. | |
719 // | |
720 // TODO(jamiewalch): Fix this once we have implemented the multi-process | |
721 // daemon architecture (crbug.com/134894) | |
722 if (getuid() == 0) { | |
723 Shutdown(kLoginScreenNotSupportedExitCode); | |
724 return false; | |
725 } | |
726 } | |
727 #endif | |
728 if (curtain_->required() != curtain_required) { | |
729 LOG(INFO) << "Updated curtain policy."; | 717 LOG(INFO) << "Updated curtain policy."; |
Jamie
2012/11/07 00:27:49
While you're here, it would be useful to log the n
Wez
2012/11/07 02:37:32
I'll be following up shortly to add an ignore-poli
Wez
2012/11/07 02:37:32
I've update the logging of all the policy values,
| |
730 curtain_->set_required(curtain_required); | 718 curtaining_host_observer_->SetEnableCurtaining(curtain_required_); |
rmsousa
2012/11/07 00:19:16
Note that the RestartHost immediately after this w
Wez
2012/11/07 02:37:32
It'll curtain the local console iff there's a conn
| |
731 return true; | 719 return true; |
732 } | 720 } |
733 return false; | 721 return false; |
734 } | 722 } |
735 | 723 |
736 bool HostProcess::OnHostTalkGadgetPrefixPolicyUpdate( | 724 bool HostProcess::OnHostTalkGadgetPrefixPolicyUpdate( |
737 const std::string& talkgadget_prefix) { | 725 const std::string& talkgadget_prefix) { |
738 // Returns true if the host has to be restarted after this policy update. | 726 // Returns true if the host has to be restarted after this policy update. |
739 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 727 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
740 | 728 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
808 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName); | 796 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName); |
809 | 797 |
810 #if defined(OS_LINUX) | 798 #if defined(OS_LINUX) |
811 // Desktop resizing is implemented on all three platforms, but may not be | 799 // Desktop resizing is implemented on all three platforms, but may not be |
812 // the right thing to do for non-virtual desktops. Disable it until we can | 800 // the right thing to do for non-virtual desktops. Disable it until we can |
813 // implement a configuration UI. | 801 // implement a configuration UI. |
814 resizing_host_observer_.reset( | 802 resizing_host_observer_.reset( |
815 new ResizingHostObserver(desktop_resizer_.get(), host_)); | 803 new ResizingHostObserver(desktop_resizer_.get(), host_)); |
816 #endif | 804 #endif |
817 | 805 |
818 // Curtain mode is currently broken on Mac (the only supported platform), | 806 // Create a host observer to enable/disable curtain mode as clients connect |
819 // so it's disabled until we've had time to fully investigate. | 807 // and disconnect. |
820 // curtaining_host_observer_.reset(new CurtainingHostObserver( | 808 curtaining_host_observer_.reset(new CurtainingHostObserver( |
rmsousa
2012/11/07 00:19:16
You need to SetEnableCurtaining again in the new o
Wez
2012/11/07 02:37:32
Done.
| |
821 // curtain_.get(), host_)); | 809 curtain_.get(), host_)); |
822 | 810 |
823 if (host_user_interface_.get()) { | 811 if (host_user_interface_.get()) { |
824 host_user_interface_->Start( | 812 host_user_interface_->Start( |
825 host_, base::Bind(&HostProcess::OnDisconnectRequested, | 813 host_, base::Bind(&HostProcess::OnDisconnectRequested, |
826 base::Unretained(this))); | 814 base::Unretained(this))); |
827 } | 815 } |
828 | 816 |
829 host_->Start(xmpp_login_); | 817 host_->Start(xmpp_login_); |
830 | 818 |
831 CreateAuthenticatorFactory(); | 819 CreateAuthenticatorFactory(); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1018 user32.GetFunctionPointer("SetProcessDPIAware")); | 1006 user32.GetFunctionPointer("SetProcessDPIAware")); |
1019 set_process_dpi_aware(); | 1007 set_process_dpi_aware(); |
1020 } | 1008 } |
1021 | 1009 |
1022 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 1010 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
1023 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 1011 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
1024 return main(0, NULL); | 1012 return main(0, NULL); |
1025 } | 1013 } |
1026 | 1014 |
1027 #endif // defined(OS_WIN) | 1015 #endif // defined(OS_WIN) |
OLD | NEW |