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

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: rebased. 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
« no previous file with comments | « remoting/host/plugin/host_script_object.cc ('k') | remoting/host/screen_recorder_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 19 matching lines...) Expand all
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/chromoting_messages.h" 37 #include "remoting/host/chromoting_messages.h"
38 #include "remoting/host/constants.h" 38 #include "remoting/host/constants.h"
39 #include "remoting/host/config_file_watcher.h" 39 #include "remoting/host/config_file_watcher.h"
40 #include "remoting/host/desktop_environment.h" 40 #include "remoting/host/desktop_environment_factory.h"
41 #include "remoting/host/dns_blackhole_checker.h" 41 #include "remoting/host/dns_blackhole_checker.h"
42 #include "remoting/host/event_executor.h" 42 #include "remoting/host/event_executor.h"
43 #include "remoting/host/heartbeat_sender.h" 43 #include "remoting/host/heartbeat_sender.h"
44 #include "remoting/host/host_config.h" 44 #include "remoting/host/host_config.h"
45 #include "remoting/host/host_event_logger.h" 45 #include "remoting/host/host_event_logger.h"
46 #include "remoting/host/host_user_interface.h" 46 #include "remoting/host/host_user_interface.h"
47 #include "remoting/host/json_host_config.h" 47 #include "remoting/host/json_host_config.h"
48 #include "remoting/host/log_to_server.h" 48 #include "remoting/host/log_to_server.h"
49 #include "remoting/host/network_settings.h" 49 #include "remoting/host/network_settings.h"
50 #include "remoting/host/policy_hack/policy_watcher.h" 50 #include "remoting/host/policy_hack/policy_watcher.h"
(...skipping 10 matching lines...) Expand all
61 #include "remoting/host/curtain_mode_mac.h" 61 #include "remoting/host/curtain_mode_mac.h"
62 #endif // defined(OS_MACOSX) 62 #endif // defined(OS_MACOSX)
63 63
64 #if defined(OS_POSIX) 64 #if defined(OS_POSIX)
65 #include <signal.h> 65 #include <signal.h>
66 #endif // defined(OS_POSIX) 66 #endif // defined(OS_POSIX)
67 67
68 // N.B. OS_WIN is defined by including src/base headers. 68 // N.B. OS_WIN is defined by including src/base headers.
69 #if defined(OS_WIN) 69 #if defined(OS_WIN)
70 #include <commctrl.h> 70 #include <commctrl.h>
71 #include "remoting/host/win/session_desktop_environment_factory.h"
71 #endif // defined(OS_WIN) 72 #endif // defined(OS_WIN)
72 73
73 #if defined(TOOLKIT_GTK) 74 #if defined(TOOLKIT_GTK)
74 #include "ui/gfx/gtk_util.h" 75 #include "ui/gfx/gtk_util.h"
75 #endif // defined(TOOLKIT_GTK) 76 #endif // defined(TOOLKIT_GTK)
76 77
77 namespace { 78 namespace {
78 79
79 // This is used for tagging system event logs. 80 // This is used for tagging system event logs.
80 const char kApplicationName[] = "chromoting"; 81 const char kApplicationName[] = "chromoting";
(...skipping 22 matching lines...) Expand all
103 : context_(context.Pass()), 104 : context_(context.Pass()),
104 config_(FilePath()), 105 config_(FilePath()),
105 #ifdef OFFICIAL_BUILD 106 #ifdef OFFICIAL_BUILD
106 oauth_use_official_client_id_(true), 107 oauth_use_official_client_id_(true),
107 #else 108 #else
108 oauth_use_official_client_id_(false), 109 oauth_use_official_client_id_(false),
109 #endif 110 #endif
110 allow_nat_traversal_(true), 111 allow_nat_traversal_(true),
111 restarting_(false), 112 restarting_(false),
112 shutting_down_(false), 113 shutting_down_(false),
114 #if defined(OS_WIN)
115 desktop_environment_factory_(new SessionDesktopEnvironmentFactory()),
116 #else // !defined(OS_WIN)
117 desktop_environment_factory_(new DesktopEnvironmentFactory()),
118 #endif // !defined(OS_WIN)
113 exit_code_(kSuccessExitCode) 119 exit_code_(kSuccessExitCode)
114 #if defined(OS_MACOSX) 120 #if defined(OS_MACOSX)
115 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested, 121 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested,
116 base::Unretained(this)), 122 base::Unretained(this)),
117 base::Bind(&HostProcess::OnDisconnectRequested, 123 base::Bind(&HostProcess::OnDisconnectRequested,
118 base::Unretained(this))) 124 base::Unretained(this)))
119 #endif 125 #endif
120 { 126 {
121 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); 127 network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
122 } 128 }
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 client_info = official_client_info; 512 client_info = official_client_info;
507 } 513 }
508 #endif // OFFICIAL_BUILD 514 #endif // OFFICIAL_BUILD
509 515
510 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials( 516 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials(
511 new SignalingConnector::OAuthCredentials( 517 new SignalingConnector::OAuthCredentials(
512 xmpp_login_, oauth_refresh_token_, client_info)); 518 xmpp_login_, oauth_refresh_token_, client_info));
513 signaling_connector_->EnableOAuth(oauth_credentials.Pass()); 519 signaling_connector_->EnableOAuth(oauth_credentials.Pass());
514 } 520 }
515 521
516 if (!desktop_environment_.get()) {
517 desktop_environment_ =
518 DesktopEnvironment::CreateForService(context_.get());
519 }
520
521 NetworkSettings network_settings( 522 NetworkSettings network_settings(
522 allow_nat_traversal_ ? 523 allow_nat_traversal_ ?
523 NetworkSettings::NAT_TRAVERSAL_ENABLED : 524 NetworkSettings::NAT_TRAVERSAL_ENABLED :
524 NetworkSettings::NAT_TRAVERSAL_DISABLED); 525 NetworkSettings::NAT_TRAVERSAL_DISABLED);
525 if (!allow_nat_traversal_) { 526 if (!allow_nat_traversal_) {
526 network_settings.min_port = NetworkSettings::kDefaultMinPort; 527 network_settings.min_port = NetworkSettings::kDefaultMinPort;
527 network_settings.max_port = NetworkSettings::kDefaultMaxPort; 528 network_settings.max_port = NetworkSettings::kDefaultMaxPort;
528 } 529 }
529 530
530 host_ = new ChromotingHost( 531 host_ = new ChromotingHost(
531 context_.get(), signal_strategy_.get(), desktop_environment_.get(), 532 context_.get(), signal_strategy_.get(),
533 desktop_environment_factory_.get(),
532 CreateHostSessionManager(network_settings, 534 CreateHostSessionManager(network_settings,
533 context_->url_request_context_getter())); 535 context_->url_request_context_getter()));
534 536
535 // TODO(simonmorris): Get the maximum session duration from a policy. 537 // TODO(simonmorris): Get the maximum session duration from a policy.
536 #if defined(OS_LINUX) 538 #if defined(OS_LINUX)
537 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); 539 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20));
538 #endif 540 #endif
539 541
540 heartbeat_sender_.reset(new HeartbeatSender( 542 heartbeat_sender_.reset(new HeartbeatSender(
541 this, host_id_, signal_strategy_.get(), &key_pair_)); 543 this, host_id_, signal_strategy_.get(), &key_pair_));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 // Complete the rest of shutdown on the main thread. 621 // Complete the rest of shutdown on the main thread.
620 context_->ui_task_runner()->PostTask( 622 context_->ui_task_runner()->PostTask(
621 FROM_HERE, 623 FROM_HERE,
622 base::Bind(&HostProcess::ShutdownHostProcess, 624 base::Bind(&HostProcess::ShutdownHostProcess,
623 base::Unretained(this))); 625 base::Unretained(this)));
624 } 626 }
625 627
626 void ResetHost() { 628 void ResetHost() {
627 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 629 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
628 630
629 desktop_environment_.reset();
630 host_event_logger_.reset(); 631 host_event_logger_.reset();
631 log_to_server_.reset(); 632 log_to_server_.reset();
632 heartbeat_sender_.reset(); 633 heartbeat_sender_.reset();
633 signaling_connector_.reset(); 634 signaling_connector_.reset();
634 signal_strategy_.reset(); 635 signal_strategy_.reset();
635 } 636 }
636 637
637 scoped_ptr<ChromotingHostContext> context_; 638 scoped_ptr<ChromotingHostContext> context_;
638 scoped_ptr<IPC::ChannelProxy> daemon_channel_; 639 scoped_ptr<IPC::ChannelProxy> daemon_channel_;
639 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; 640 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
(...skipping 14 matching lines...) Expand all
654 std::string oauth_refresh_token_; 655 std::string oauth_refresh_token_;
655 bool oauth_use_official_client_id_; 656 bool oauth_use_official_client_id_;
656 657
657 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; 658 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_;
658 bool allow_nat_traversal_; 659 bool allow_nat_traversal_;
659 std::string talkgadget_prefix_; 660 std::string talkgadget_prefix_;
660 661
661 bool restarting_; 662 bool restarting_;
662 bool shutting_down_; 663 bool shutting_down_;
663 664
665 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
664 scoped_ptr<XmppSignalStrategy> signal_strategy_; 666 scoped_ptr<XmppSignalStrategy> signal_strategy_;
665 scoped_ptr<SignalingConnector> signaling_connector_; 667 scoped_ptr<SignalingConnector> signaling_connector_;
666 scoped_ptr<DesktopEnvironment> desktop_environment_;
667 scoped_ptr<HeartbeatSender> heartbeat_sender_; 668 scoped_ptr<HeartbeatSender> heartbeat_sender_;
668 scoped_ptr<LogToServer> log_to_server_; 669 scoped_ptr<LogToServer> log_to_server_;
669 scoped_ptr<HostEventLogger> host_event_logger_; 670 scoped_ptr<HostEventLogger> host_event_logger_;
670 671
671 #if defined(OS_MACOSX) || defined(OS_WIN) 672 #if defined(OS_MACOSX) || defined(OS_WIN)
672 scoped_ptr<HostUserInterface> host_user_interface_; 673 scoped_ptr<HostUserInterface> host_user_interface_;
673 #endif 674 #endif
674 675
675 scoped_refptr<ChromotingHost> host_; 676 scoped_refptr<ChromotingHost> host_;
676 677
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
787 user32.GetFunctionPointer("SetProcessDPIAware")); 788 user32.GetFunctionPointer("SetProcessDPIAware"));
788 set_process_dpi_aware(); 789 set_process_dpi_aware();
789 } 790 }
790 791
791 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting 792 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting
792 // the command line from GetCommandLineW(), so we can safely pass NULL here. 793 // the command line from GetCommandLineW(), so we can safely pass NULL here.
793 return main(0, NULL); 794 return main(0, NULL);
794 } 795 }
795 796
796 #endif // defined(OS_WIN) 797 #endif // defined(OS_WIN)
OLDNEW
« no previous file with comments | « remoting/host/plugin/host_script_object.cc ('k') | remoting/host/screen_recorder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698