Chromium Code Reviews| 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 22 matching lines...) Expand all Loading... | |
| 33 #include "remoting/base/breakpad.h" | 33 #include "remoting/base/breakpad.h" |
| 34 #include "remoting/base/constants.h" | 34 #include "remoting/base/constants.h" |
| 35 #include "remoting/host/branding.h" | 35 #include "remoting/host/branding.h" |
| 36 #include "remoting/host/chromoting_host.h" | 36 #include "remoting/host/chromoting_host.h" |
| 37 #include "remoting/host/chromoting_host_context.h" | 37 #include "remoting/host/chromoting_host_context.h" |
| 38 #include "remoting/host/chromoting_messages.h" | 38 #include "remoting/host/chromoting_messages.h" |
| 39 #include "remoting/host/config_file_watcher.h" | 39 #include "remoting/host/config_file_watcher.h" |
| 40 #include "remoting/host/constants.h" | 40 #include "remoting/host/constants.h" |
| 41 #include "remoting/host/config_file_watcher.h" | 41 #include "remoting/host/config_file_watcher.h" |
| 42 #include "remoting/host/desktop_environment_factory.h" | 42 #include "remoting/host/desktop_environment_factory.h" |
| 43 #include "remoting/host/desktop_resizer.h" | |
| 43 #include "remoting/host/dns_blackhole_checker.h" | 44 #include "remoting/host/dns_blackhole_checker.h" |
| 44 #include "remoting/host/event_executor.h" | 45 #include "remoting/host/event_executor.h" |
| 45 #include "remoting/host/heartbeat_sender.h" | 46 #include "remoting/host/heartbeat_sender.h" |
| 46 #include "remoting/host/host_config.h" | 47 #include "remoting/host/host_config.h" |
| 47 #include "remoting/host/host_event_logger.h" | 48 #include "remoting/host/host_event_logger.h" |
| 48 #include "remoting/host/host_user_interface.h" | 49 #include "remoting/host/host_user_interface.h" |
| 49 #include "remoting/host/json_host_config.h" | 50 #include "remoting/host/json_host_config.h" |
| 50 #include "remoting/host/log_to_server.h" | 51 #include "remoting/host/log_to_server.h" |
| 51 #include "remoting/host/network_settings.h" | 52 #include "remoting/host/network_settings.h" |
| 52 #include "remoting/host/policy_hack/policy_watcher.h" | 53 #include "remoting/host/policy_hack/policy_watcher.h" |
| 54 #include "remoting/host/resizing_host_observer.h" | |
| 53 #include "remoting/host/session_manager_factory.h" | 55 #include "remoting/host/session_manager_factory.h" |
| 54 #include "remoting/host/signaling_connector.h" | 56 #include "remoting/host/signaling_connector.h" |
| 55 #include "remoting/host/usage_stats_consent.h" | 57 #include "remoting/host/usage_stats_consent.h" |
| 56 #include "remoting/host/video_frame_capturer.h" | 58 #include "remoting/host/video_frame_capturer.h" |
| 57 #include "remoting/jingle_glue/xmpp_signal_strategy.h" | 59 #include "remoting/jingle_glue/xmpp_signal_strategy.h" |
| 58 #include "remoting/protocol/me2me_host_authenticator_factory.h" | 60 #include "remoting/protocol/me2me_host_authenticator_factory.h" |
| 59 | 61 |
| 60 #if defined(OS_POSIX) | 62 #if defined(OS_POSIX) |
| 61 #include <signal.h> | 63 #include <signal.h> |
| 62 #include "remoting/host/posix/signal_handler.h" | 64 #include "remoting/host/posix/signal_handler.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 oauth_use_official_client_id_(false), | 125 oauth_use_official_client_id_(false), |
| 124 #endif | 126 #endif |
| 125 allow_nat_traversal_(true), | 127 allow_nat_traversal_(true), |
| 126 restarting_(false), | 128 restarting_(false), |
| 127 shutting_down_(false), | 129 shutting_down_(false), |
| 128 #if defined(OS_WIN) | 130 #if defined(OS_WIN) |
| 129 desktop_environment_factory_(new SessionDesktopEnvironmentFactory()), | 131 desktop_environment_factory_(new SessionDesktopEnvironmentFactory()), |
| 130 #else // !defined(OS_WIN) | 132 #else // !defined(OS_WIN) |
| 131 desktop_environment_factory_(new DesktopEnvironmentFactory()), | 133 desktop_environment_factory_(new DesktopEnvironmentFactory()), |
| 132 #endif // !defined(OS_WIN) | 134 #endif // !defined(OS_WIN) |
| 135 desktop_resizer_(DesktopResizer::Create()), | |
| 133 exit_code_(kSuccessExitCode) | 136 exit_code_(kSuccessExitCode) |
| 134 #if defined(OS_MACOSX) | 137 #if defined(OS_MACOSX) |
| 135 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested, | 138 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested, |
| 136 base::Unretained(this)), | 139 base::Unretained(this)), |
| 137 base::Bind(&HostProcess::OnDisconnectRequested, | 140 base::Bind(&HostProcess::OnDisconnectRequested, |
| 138 base::Unretained(this))) | 141 base::Unretained(this))) |
| 139 #endif | 142 #endif |
| 140 { | 143 { |
| 141 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); | 144 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); |
| 142 } | 145 } |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 567 context_.get(), signal_strategy_.get(), | 570 context_.get(), signal_strategy_.get(), |
| 568 desktop_environment_factory_.get(), | 571 desktop_environment_factory_.get(), |
| 569 CreateHostSessionManager(network_settings, | 572 CreateHostSessionManager(network_settings, |
| 570 context_->url_request_context_getter())); | 573 context_->url_request_context_getter())); |
| 571 | 574 |
| 572 // TODO(simonmorris): Get the maximum session duration from a policy. | 575 // TODO(simonmorris): Get the maximum session duration from a policy. |
| 573 #if defined(OS_LINUX) | 576 #if defined(OS_LINUX) |
| 574 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); | 577 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); |
| 575 #endif | 578 #endif |
| 576 | 579 |
| 580 host_->AddStatusObserver(new ResizingHostObserver(desktop_resizer_.get())); | |
|
Wez
2012/09/20 21:35:15
You also need to remove the observer at some point
Jamie
2012/09/20 22:59:59
I don't think it ever needs to be removed, but thi
Wez
2012/09/21 00:59:32
If it isn't removed then the ChromotingHost may ou
Jamie
2012/09/24 22:49:15
I'd forgotten that the host is reference-counted.
| |
| 581 | |
| 577 heartbeat_sender_.reset(new HeartbeatSender( | 582 heartbeat_sender_.reset(new HeartbeatSender( |
| 578 this, host_id_, signal_strategy_.get(), &key_pair_)); | 583 this, host_id_, signal_strategy_.get(), &key_pair_)); |
| 579 | 584 |
| 580 log_to_server_.reset( | 585 log_to_server_.reset( |
| 581 new LogToServer(host_, ServerLogEntry::ME2ME, signal_strategy_.get())); | 586 new LogToServer(host_, ServerLogEntry::ME2ME, signal_strategy_.get())); |
| 582 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName); | 587 host_event_logger_ = HostEventLogger::Create(host_, kApplicationName); |
| 583 | 588 |
| 584 #if defined(OS_MACOSX) || defined(OS_WIN) | 589 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 585 if (host_user_interface_.get()) { | 590 if (host_user_interface_.get()) { |
| 586 host_user_interface_->Start( | 591 host_user_interface_->Start( |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 691 bool oauth_use_official_client_id_; | 696 bool oauth_use_official_client_id_; |
| 692 | 697 |
| 693 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; | 698 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; |
| 694 bool allow_nat_traversal_; | 699 bool allow_nat_traversal_; |
| 695 std::string talkgadget_prefix_; | 700 std::string talkgadget_prefix_; |
| 696 | 701 |
| 697 bool restarting_; | 702 bool restarting_; |
| 698 bool shutting_down_; | 703 bool shutting_down_; |
| 699 | 704 |
| 700 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; | 705 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; |
| 706 scoped_ptr<DesktopResizer> desktop_resizer_; | |
| 701 scoped_ptr<XmppSignalStrategy> signal_strategy_; | 707 scoped_ptr<XmppSignalStrategy> signal_strategy_; |
| 702 scoped_ptr<SignalingConnector> signaling_connector_; | 708 scoped_ptr<SignalingConnector> signaling_connector_; |
| 703 scoped_ptr<HeartbeatSender> heartbeat_sender_; | 709 scoped_ptr<HeartbeatSender> heartbeat_sender_; |
| 704 scoped_ptr<LogToServer> log_to_server_; | 710 scoped_ptr<LogToServer> log_to_server_; |
| 705 scoped_ptr<HostEventLogger> host_event_logger_; | 711 scoped_ptr<HostEventLogger> host_event_logger_; |
| 706 | 712 |
| 707 #if defined(OS_MACOSX) || defined(OS_WIN) | 713 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 708 scoped_ptr<HostUserInterface> host_user_interface_; | 714 scoped_ptr<HostUserInterface> host_user_interface_; |
| 709 #endif | 715 #endif |
| 710 | 716 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 822 user32.GetFunctionPointer("SetProcessDPIAware")); | 828 user32.GetFunctionPointer("SetProcessDPIAware")); |
| 823 set_process_dpi_aware(); | 829 set_process_dpi_aware(); |
| 824 } | 830 } |
| 825 | 831 |
| 826 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting | 832 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting |
| 827 // the command line from GetCommandLineW(), so we can safely pass NULL here. | 833 // the command line from GetCommandLineW(), so we can safely pass NULL here. |
| 828 return main(0, NULL); | 834 return main(0, NULL); |
| 829 } | 835 } |
| 830 | 836 |
| 831 #endif // defined(OS_WIN) | 837 #endif // defined(OS_WIN) |
| OLD | NEW |