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