Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: remoting/host/remoting_me2me_host.cc

Issue 10920019: [Chromoting] Refactoring DesktopEnvironment and moving screen/audio recorders to ClientSession. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 18 matching lines...) Expand all
29 #include "net/base/network_change_notifier.h" 29 #include "net/base/network_change_notifier.h"
30 #include "net/socket/ssl_server_socket.h" 30 #include "net/socket/ssl_server_socket.h"
31 #include "remoting/base/auto_thread_task_runner.h" 31 #include "remoting/base/auto_thread_task_runner.h"
32 #include "remoting/base/breakpad.h" 32 #include "remoting/base/breakpad.h"
33 #include "remoting/base/constants.h" 33 #include "remoting/base/constants.h"
34 #include "remoting/host/branding.h" 34 #include "remoting/host/branding.h"
35 #include "remoting/host/chromoting_host.h" 35 #include "remoting/host/chromoting_host.h"
36 #include "remoting/host/chromoting_host_context.h" 36 #include "remoting/host/chromoting_host_context.h"
37 #include "remoting/host/composite_host_config.h" 37 #include "remoting/host/composite_host_config.h"
38 #include "remoting/host/constants.h" 38 #include "remoting/host/constants.h"
39 #include "remoting/host/desktop_environment.h"
40 #include "remoting/host/event_executor.h" 39 #include "remoting/host/event_executor.h"
41 #include "remoting/host/heartbeat_sender.h" 40 #include "remoting/host/heartbeat_sender.h"
42 #include "remoting/host/host_config.h" 41 #include "remoting/host/host_config.h"
43 #include "remoting/host/host_event_logger.h" 42 #include "remoting/host/host_event_logger.h"
44 #include "remoting/host/host_user_interface.h" 43 #include "remoting/host/host_user_interface.h"
45 #include "remoting/host/log_to_server.h" 44 #include "remoting/host/log_to_server.h"
46 #include "remoting/host/network_settings.h" 45 #include "remoting/host/network_settings.h"
47 #include "remoting/host/policy_hack/policy_watcher.h" 46 #include "remoting/host/policy_hack/policy_watcher.h"
48 #include "remoting/host/session_manager_factory.h" 47 #include "remoting/host/session_manager_factory.h"
49 #include "remoting/host/signaling_connector.h" 48 #include "remoting/host/signaling_connector.h"
50 #include "remoting/host/usage_stats_consent.h" 49 #include "remoting/host/usage_stats_consent.h"
51 #include "remoting/host/video_frame_capturer.h" 50 #include "remoting/host/video_frame_capturer.h"
51 #include "remoting/host/win/session_desktop_environment_factory.h"
52 #include "remoting/jingle_glue/xmpp_signal_strategy.h" 52 #include "remoting/jingle_glue/xmpp_signal_strategy.h"
53 #include "remoting/protocol/me2me_host_authenticator_factory.h" 53 #include "remoting/protocol/me2me_host_authenticator_factory.h"
54 54
55 #if defined(OS_POSIX) 55 #if defined(OS_POSIX)
56 #include "remoting/host/posix/sighup_listener.h" 56 #include "remoting/host/posix/sighup_listener.h"
57 #endif // defined(OS_POSIX) 57 #endif // defined(OS_POSIX)
58 58
59 #if defined(OS_MACOSX) 59 #if defined(OS_MACOSX)
60 #include "base/mac/scoped_cftyperef.h" 60 #include "base/mac/scoped_cftyperef.h"
61 #include "base/mac/scoped_nsautorelease_pool.h" 61 #include "base/mac/scoped_nsautorelease_pool.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 HostProcess(scoped_ptr<ChromotingHostContext> context) 113 HostProcess(scoped_ptr<ChromotingHostContext> context)
114 : context_(context.Pass()), 114 : context_(context.Pass()),
115 #ifdef OFFICIAL_BUILD 115 #ifdef OFFICIAL_BUILD
116 oauth_use_official_client_id_(true), 116 oauth_use_official_client_id_(true),
117 #else 117 #else
118 oauth_use_official_client_id_(false), 118 oauth_use_official_client_id_(false),
119 #endif 119 #endif
120 allow_nat_traversal_(true), 120 allow_nat_traversal_(true),
121 restarting_(false), 121 restarting_(false),
122 shutting_down_(false), 122 shutting_down_(false),
123 desktop_environment_factory_(new SessionDesktopEnvironmentFactory()),
Wez 2012/08/31 18:18:02 Isn't SessionDesktopEnvironmentFactory Windows-onl
alexeypa (please no reviews) 2012/08/31 23:13:30 Yes, indeed.
123 exit_code_(kSuccessExitCode) 124 exit_code_(kSuccessExitCode)
124 #if defined(OS_MACOSX) 125 #if defined(OS_MACOSX)
125 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested, 126 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested,
126 base::Unretained(this)), 127 base::Unretained(this)),
127 base::Bind(&HostProcess::OnDisconnectRequested, 128 base::Bind(&HostProcess::OnDisconnectRequested,
128 base::Unretained(this))) 129 base::Unretained(this)))
129 #endif 130 #endif
130 { 131 {
131 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); 132 network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
132 config_updated_timer_.reset(new base::DelayTimer<HostProcess>( 133 config_updated_timer_.reset(new base::DelayTimer<HostProcess>(
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 499
499 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials( 500 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials(
500 new SignalingConnector::OAuthCredentials( 501 new SignalingConnector::OAuthCredentials(
501 xmpp_login_, oauth_refresh_token_, client_info)); 502 xmpp_login_, oauth_refresh_token_, client_info));
502 signaling_connector_->EnableOAuth( 503 signaling_connector_->EnableOAuth(
503 oauth_credentials.Pass(), 504 oauth_credentials.Pass(),
504 context_->url_request_context_getter()); 505 context_->url_request_context_getter());
505 } 506 }
506 } 507 }
507 508
508 if (!desktop_environment_.get()) {
509 desktop_environment_ =
510 DesktopEnvironment::CreateForService(context_.get());
511 }
512
513 NetworkSettings network_settings( 509 NetworkSettings network_settings(
514 allow_nat_traversal_ ? 510 allow_nat_traversal_ ?
515 NetworkSettings::NAT_TRAVERSAL_ENABLED : 511 NetworkSettings::NAT_TRAVERSAL_ENABLED :
516 NetworkSettings::NAT_TRAVERSAL_DISABLED); 512 NetworkSettings::NAT_TRAVERSAL_DISABLED);
517 if (!allow_nat_traversal_) { 513 if (!allow_nat_traversal_) {
518 network_settings.min_port = kMinPortNumber; 514 network_settings.min_port = kMinPortNumber;
519 network_settings.max_port = kMaxPortNumber; 515 network_settings.max_port = kMaxPortNumber;
520 } 516 }
521 517
522 host_ = new ChromotingHost( 518 host_ = new ChromotingHost(
523 context_.get(), signal_strategy_.get(), desktop_environment_.get(), 519 context_.get(), signal_strategy_.get(),
520 desktop_environment_factory_.get(),
524 CreateHostSessionManager(network_settings, 521 CreateHostSessionManager(network_settings,
525 context_->url_request_context_getter())); 522 context_->url_request_context_getter()));
526 523
527 // TODO(simonmorris): Get the maximum session duration from a policy. 524 // TODO(simonmorris): Get the maximum session duration from a policy.
528 #if defined(OS_LINUX) 525 #if defined(OS_LINUX)
529 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); 526 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20));
530 #endif 527 #endif
531 528
532 heartbeat_sender_.reset(new HeartbeatSender( 529 heartbeat_sender_.reset(new HeartbeatSender(
533 this, host_id_, signal_strategy_.get(), &key_pair_)); 530 this, host_id_, signal_strategy_.get(), &key_pair_));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 } else { 596 } else {
600 OnShutdownFinished(); 597 OnShutdownFinished();
601 } 598 }
602 } 599 }
603 600
604 void OnShutdownFinished() { 601 void OnShutdownFinished() {
605 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 602 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
606 603
607 // Destroy networking objects while we are on the network thread. 604 // Destroy networking objects while we are on the network thread.
608 host_ = NULL; 605 host_ = NULL;
609 desktop_environment_.reset();
610 host_event_logger_.reset(); 606 host_event_logger_.reset();
611 log_to_server_.reset(); 607 log_to_server_.reset();
612 heartbeat_sender_.reset(); 608 heartbeat_sender_.reset();
613 signaling_connector_.reset(); 609 signaling_connector_.reset();
614 signal_strategy_.reset(); 610 signal_strategy_.reset();
615 611
616 // Complete the rest of shutdown on the main thread. 612 // Complete the rest of shutdown on the main thread.
617 context_->ui_task_runner()->PostTask( 613 context_->ui_task_runner()->PostTask(
618 FROM_HERE, 614 FROM_HERE,
619 base::Bind(&HostProcess::ShutdownHostProcess, 615 base::Bind(&HostProcess::ShutdownHostProcess,
(...skipping 18 matching lines...) Expand all
638 bool oauth_use_official_client_id_; 634 bool oauth_use_official_client_id_;
639 635
640 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; 636 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_;
641 bool allow_nat_traversal_; 637 bool allow_nat_traversal_;
642 scoped_ptr<base::files::FilePathWatcher> config_watcher_; 638 scoped_ptr<base::files::FilePathWatcher> config_watcher_;
643 scoped_ptr<base::DelayTimer<HostProcess> > config_updated_timer_; 639 scoped_ptr<base::DelayTimer<HostProcess> > config_updated_timer_;
644 640
645 bool restarting_; 641 bool restarting_;
646 bool shutting_down_; 642 bool shutting_down_;
647 643
644 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
648 scoped_ptr<XmppSignalStrategy> signal_strategy_; 645 scoped_ptr<XmppSignalStrategy> signal_strategy_;
649 scoped_ptr<SignalingConnector> signaling_connector_; 646 scoped_ptr<SignalingConnector> signaling_connector_;
650 scoped_ptr<DesktopEnvironment> desktop_environment_;
651 scoped_ptr<HeartbeatSender> heartbeat_sender_; 647 scoped_ptr<HeartbeatSender> heartbeat_sender_;
652 scoped_ptr<LogToServer> log_to_server_; 648 scoped_ptr<LogToServer> log_to_server_;
653 scoped_ptr<HostEventLogger> host_event_logger_; 649 scoped_ptr<HostEventLogger> host_event_logger_;
654 650
655 #if defined(OS_MACOSX) || defined(OS_WIN) 651 #if defined(OS_MACOSX) || defined(OS_WIN)
656 scoped_ptr<HostUserInterface> host_user_interface_; 652 scoped_ptr<HostUserInterface> host_user_interface_;
657 #endif 653 #endif
658 654
659 scoped_refptr<ChromotingHost> host_; 655 scoped_refptr<ChromotingHost> host_;
660 656
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 user32.GetFunctionPointer("SetProcessDPIAware")); 761 user32.GetFunctionPointer("SetProcessDPIAware"));
766 set_process_dpi_aware(); 762 set_process_dpi_aware();
767 } 763 }
768 764
769 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting 765 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting
770 // the command line from GetCommandLineW(), so we can safely pass NULL here. 766 // the command line from GetCommandLineW(), so we can safely pass NULL here.
771 return main(0, NULL); 767 return main(0, NULL);
772 } 768 }
773 769
774 #endif // defined(OS_WIN) 770 #endif // defined(OS_WIN)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698