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 23 matching lines...) Expand all Loading... |
34 #include "remoting/base/constants.h" | 34 #include "remoting/base/constants.h" |
35 #include "remoting/host/basic_desktop_environment.h" | 35 #include "remoting/host/basic_desktop_environment.h" |
36 #include "remoting/host/branding.h" | 36 #include "remoting/host/branding.h" |
37 #include "remoting/host/chromoting_host.h" | 37 #include "remoting/host/chromoting_host.h" |
38 #include "remoting/host/chromoting_host_context.h" | 38 #include "remoting/host/chromoting_host_context.h" |
39 #include "remoting/host/chromoting_messages.h" | 39 #include "remoting/host/chromoting_messages.h" |
40 #include "remoting/host/config_file_watcher.h" | 40 #include "remoting/host/config_file_watcher.h" |
41 #include "remoting/host/curtain_mode.h" | 41 #include "remoting/host/curtain_mode.h" |
42 #include "remoting/host/curtaining_host_observer.h" | 42 #include "remoting/host/curtaining_host_observer.h" |
43 #include "remoting/host/desktop_environment.h" | 43 #include "remoting/host/desktop_environment.h" |
44 #include "remoting/host/desktop_resizer.h" | |
45 #include "remoting/host/desktop_session_connector.h" | 44 #include "remoting/host/desktop_session_connector.h" |
46 #include "remoting/host/dns_blackhole_checker.h" | 45 #include "remoting/host/dns_blackhole_checker.h" |
47 #include "remoting/host/event_executor.h" | 46 #include "remoting/host/event_executor.h" |
48 #include "remoting/host/heartbeat_sender.h" | 47 #include "remoting/host/heartbeat_sender.h" |
49 #include "remoting/host/host_change_notification_listener.h" | 48 #include "remoting/host/host_change_notification_listener.h" |
50 #include "remoting/host/host_config.h" | 49 #include "remoting/host/host_config.h" |
51 #include "remoting/host/host_event_logger.h" | 50 #include "remoting/host/host_event_logger.h" |
52 #include "remoting/host/host_exit_codes.h" | 51 #include "remoting/host/host_exit_codes.h" |
53 #include "remoting/host/host_main.h" | 52 #include "remoting/host/host_main.h" |
54 #include "remoting/host/host_user_interface.h" | 53 #include "remoting/host/host_user_interface.h" |
55 #include "remoting/host/ipc_constants.h" | 54 #include "remoting/host/ipc_constants.h" |
56 #include "remoting/host/ipc_desktop_environment.h" | 55 #include "remoting/host/ipc_desktop_environment.h" |
57 #include "remoting/host/ipc_host_event_logger.h" | 56 #include "remoting/host/ipc_host_event_logger.h" |
58 #include "remoting/host/json_host_config.h" | 57 #include "remoting/host/json_host_config.h" |
59 #include "remoting/host/log_to_server.h" | 58 #include "remoting/host/log_to_server.h" |
60 #include "remoting/host/logging.h" | 59 #include "remoting/host/logging.h" |
61 #include "remoting/host/network_settings.h" | 60 #include "remoting/host/network_settings.h" |
62 #include "remoting/host/policy_hack/policy_watcher.h" | 61 #include "remoting/host/policy_hack/policy_watcher.h" |
63 #include "remoting/host/resizing_host_observer.h" | |
64 #include "remoting/host/service_urls.h" | 62 #include "remoting/host/service_urls.h" |
65 #include "remoting/host/session_manager_factory.h" | 63 #include "remoting/host/session_manager_factory.h" |
66 #include "remoting/host/signaling_connector.h" | 64 #include "remoting/host/signaling_connector.h" |
67 #include "remoting/host/ui_strings.h" | 65 #include "remoting/host/ui_strings.h" |
68 #include "remoting/host/usage_stats_consent.h" | 66 #include "remoting/host/usage_stats_consent.h" |
69 #include "remoting/jingle_glue/xmpp_signal_strategy.h" | 67 #include "remoting/jingle_glue/xmpp_signal_strategy.h" |
70 #include "remoting/protocol/me2me_host_authenticator_factory.h" | 68 #include "remoting/protocol/me2me_host_authenticator_factory.h" |
71 | 69 |
72 #if defined(OS_POSIX) | 70 #if defined(OS_POSIX) |
73 #include <pwd.h> | 71 #include <pwd.h> |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 std::string xmpp_auth_token_; | 290 std::string xmpp_auth_token_; |
293 std::string xmpp_auth_service_; | 291 std::string xmpp_auth_service_; |
294 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; | 292 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; |
295 bool allow_nat_traversal_; | 293 bool allow_nat_traversal_; |
296 std::string talkgadget_prefix_; | 294 std::string talkgadget_prefix_; |
297 | 295 |
298 scoped_ptr<CurtainMode> curtain_; | 296 scoped_ptr<CurtainMode> curtain_; |
299 scoped_ptr<CurtainingHostObserver> curtaining_host_observer_; | 297 scoped_ptr<CurtainingHostObserver> curtaining_host_observer_; |
300 bool curtain_required_; | 298 bool curtain_required_; |
301 | 299 |
302 scoped_ptr<DesktopResizer> desktop_resizer_; | |
303 scoped_ptr<ResizingHostObserver> resizing_host_observer_; | |
304 scoped_ptr<XmppSignalStrategy> signal_strategy_; | 300 scoped_ptr<XmppSignalStrategy> signal_strategy_; |
305 scoped_ptr<SignalingConnector> signaling_connector_; | 301 scoped_ptr<SignalingConnector> signaling_connector_; |
306 scoped_ptr<HeartbeatSender> heartbeat_sender_; | 302 scoped_ptr<HeartbeatSender> heartbeat_sender_; |
307 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_; | 303 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_; |
308 scoped_ptr<LogToServer> log_to_server_; | 304 scoped_ptr<LogToServer> log_to_server_; |
309 scoped_ptr<HostEventLogger> host_event_logger_; | 305 scoped_ptr<HostEventLogger> host_event_logger_; |
310 | 306 |
311 // Created on the UI thread and used on the network thread. | 307 // Created on the UI thread and used on the network thread. |
312 scoped_ptr<HostUserInterface> host_user_interface_; | 308 scoped_ptr<HostUserInterface> host_user_interface_; |
313 | 309 |
314 scoped_refptr<ChromotingHost> host_; | 310 scoped_refptr<ChromotingHost> host_; |
315 | 311 |
316 // Used to keep this HostProcess alive until it is shutdown. | 312 // Used to keep this HostProcess alive until it is shutdown. |
317 scoped_refptr<HostProcess> self_; | 313 scoped_refptr<HostProcess> self_; |
318 | 314 |
319 #if defined(REMOTING_MULTI_PROCESS) | 315 #if defined(REMOTING_MULTI_PROCESS) |
320 DesktopSessionConnector* desktop_session_connector_; | 316 DesktopSessionConnector* desktop_session_connector_; |
321 #endif // defined(REMOTING_MULTI_PROCESS) | 317 #endif // defined(REMOTING_MULTI_PROCESS) |
322 | 318 |
323 int* exit_code_out_; | 319 int* exit_code_out_; |
324 }; | 320 }; |
325 | 321 |
326 HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context, | 322 HostProcess::HostProcess(scoped_ptr<ChromotingHostContext> context, |
327 int* exit_code_out) | 323 int* exit_code_out) |
328 : context_(context.Pass()), | 324 : context_(context.Pass()), |
329 state_(HOST_INITIALIZING), | 325 state_(HOST_INITIALIZING), |
330 allow_nat_traversal_(true), | 326 allow_nat_traversal_(true), |
331 curtain_required_(false), | 327 curtain_required_(false), |
332 desktop_resizer_(DesktopResizer::Create()), | |
333 #if defined(REMOTING_MULTI_PROCESS) | 328 #if defined(REMOTING_MULTI_PROCESS) |
334 desktop_session_connector_(NULL), | 329 desktop_session_connector_(NULL), |
335 #endif // defined(REMOTING_MULTI_PROCESS) | 330 #endif // defined(REMOTING_MULTI_PROCESS) |
336 ALLOW_THIS_IN_INITIALIZER_LIST(self_(this)), | 331 ALLOW_THIS_IN_INITIALIZER_LIST(self_(this)), |
337 exit_code_out_(exit_code_out) { | 332 exit_code_out_(exit_code_out) { |
338 // Create a NetworkChangeNotifier for use by the signalling connector. | 333 // Create a NetworkChangeNotifier for use by the signalling connector. |
339 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | 334 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
340 | 335 |
341 // Create the platform-specific curtain-mode implementation. | 336 // Create the platform-specific curtain-mode implementation. |
342 // TODO(wez): Create this on the network thread? | 337 // TODO(wez): Create this on the network thread? |
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
962 | 957 |
963 // Set up repoting the host status notifications. | 958 // Set up repoting the host status notifications. |
964 #if defined(REMOTING_MULTI_PROCESS) | 959 #if defined(REMOTING_MULTI_PROCESS) |
965 host_event_logger_.reset( | 960 host_event_logger_.reset( |
966 new IpcHostEventLogger(host_->AsWeakPtr(), daemon_channel_.get())); | 961 new IpcHostEventLogger(host_->AsWeakPtr(), daemon_channel_.get())); |
967 #else // !defined(REMOTING_MULTI_PROCESS) | 962 #else // !defined(REMOTING_MULTI_PROCESS) |
968 host_event_logger_ = | 963 host_event_logger_ = |
969 HostEventLogger::Create(host_->AsWeakPtr(), kApplicationName); | 964 HostEventLogger::Create(host_->AsWeakPtr(), kApplicationName); |
970 #endif // !defined(REMOTING_MULTI_PROCESS) | 965 #endif // !defined(REMOTING_MULTI_PROCESS) |
971 | 966 |
972 resizing_host_observer_.reset( | |
973 new ResizingHostObserver(desktop_resizer_.get(), host_->AsWeakPtr())); | |
974 | |
975 #if defined(REMOTING_RDP_SESSION) | 967 #if defined(REMOTING_RDP_SESSION) |
976 // TODO(alexeypa): do not create |curtain_| in this case. | 968 // TODO(alexeypa): do not create |curtain_| in this case. |
977 CurtainMode* curtain = static_cast<IpcDesktopEnvironmentFactory*>( | 969 CurtainMode* curtain = static_cast<IpcDesktopEnvironmentFactory*>( |
978 desktop_environment_factory_.get()); | 970 desktop_environment_factory_.get()); |
979 #else // !defined(REMOTING_RDP_SESSION) | 971 #else // !defined(REMOTING_RDP_SESSION) |
980 CurtainMode* curtain = curtain_.get(); | 972 CurtainMode* curtain = curtain_.get(); |
981 #endif // !defined(REMOTING_RDP_SESSION) | 973 #endif // !defined(REMOTING_RDP_SESSION) |
982 | 974 |
983 // Create a host observer to enable/disable curtain mode as clients connect | 975 // Create a host observer to enable/disable curtain mode as clients connect |
984 // and disconnect. | 976 // and disconnect. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 1057 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
1066 | 1058 |
1067 host_ = NULL; | 1059 host_ = NULL; |
1068 curtaining_host_observer_.reset(); | 1060 curtaining_host_observer_.reset(); |
1069 host_event_logger_.reset(); | 1061 host_event_logger_.reset(); |
1070 log_to_server_.reset(); | 1062 log_to_server_.reset(); |
1071 heartbeat_sender_.reset(); | 1063 heartbeat_sender_.reset(); |
1072 host_change_notification_listener_.reset(); | 1064 host_change_notification_listener_.reset(); |
1073 signaling_connector_.reset(); | 1065 signaling_connector_.reset(); |
1074 signal_strategy_.reset(); | 1066 signal_strategy_.reset(); |
1075 resizing_host_observer_.reset(); | |
1076 | 1067 |
1077 if (state_ == HOST_STOPPING_TO_RESTART) { | 1068 if (state_ == HOST_STOPPING_TO_RESTART) { |
1078 StartHost(); | 1069 StartHost(); |
1079 } else if (state_ == HOST_STOPPING) { | 1070 } else if (state_ == HOST_STOPPING) { |
1080 state_ = HOST_STOPPED; | 1071 state_ = HOST_STOPPED; |
1081 | 1072 |
1082 if (policy_watcher_.get()) { | 1073 if (policy_watcher_.get()) { |
1083 base::WaitableEvent done_event(true, false); | 1074 base::WaitableEvent done_event(true, false); |
1084 policy_watcher_->StopWatching(&done_event); | 1075 policy_watcher_->StopWatching(&done_event); |
1085 done_event.Wait(); | 1076 done_event.Wait(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 return exit_code; | 1129 return exit_code; |
1139 } | 1130 } |
1140 | 1131 |
1141 } // namespace remoting | 1132 } // namespace remoting |
1142 | 1133 |
1143 #if !defined(OS_WIN) | 1134 #if !defined(OS_WIN) |
1144 int main(int argc, char** argv) { | 1135 int main(int argc, char** argv) { |
1145 return remoting::HostMain(argc, argv); | 1136 return remoting::HostMain(argc, argv); |
1146 } | 1137 } |
1147 #endif // !defined(OS_WIN) | 1138 #endif // !defined(OS_WIN) |
OLD | NEW |