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

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

Issue 10915206: [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 21 matching lines...) Expand all
32 #include "remoting/base/auto_thread_task_runner.h" 32 #include "remoting/base/auto_thread_task_runner.h"
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.h" 42 #include "remoting/host/desktop_environment_factory.h"
43 #include "remoting/host/dns_blackhole_checker.h" 43 #include "remoting/host/dns_blackhole_checker.h"
44 #include "remoting/host/event_executor.h" 44 #include "remoting/host/event_executor.h"
45 #include "remoting/host/heartbeat_sender.h" 45 #include "remoting/host/heartbeat_sender.h"
46 #include "remoting/host/host_config.h" 46 #include "remoting/host/host_config.h"
47 #include "remoting/host/host_event_logger.h" 47 #include "remoting/host/host_event_logger.h"
48 #include "remoting/host/host_user_interface.h" 48 #include "remoting/host/host_user_interface.h"
49 #include "remoting/host/json_host_config.h" 49 #include "remoting/host/json_host_config.h"
50 #include "remoting/host/log_to_server.h" 50 #include "remoting/host/log_to_server.h"
51 #include "remoting/host/network_settings.h" 51 #include "remoting/host/network_settings.h"
52 #include "remoting/host/policy_hack/policy_watcher.h" 52 #include "remoting/host/policy_hack/policy_watcher.h"
(...skipping 15 matching lines...) Expand all
68 #include "remoting/host/curtain_mode_mac.h" 68 #include "remoting/host/curtain_mode_mac.h"
69 #endif // defined(OS_MACOSX) 69 #endif // defined(OS_MACOSX)
70 70
71 #if defined(OS_POSIX) 71 #if defined(OS_POSIX)
72 #include <signal.h> 72 #include <signal.h>
73 #endif // defined(OS_POSIX) 73 #endif // defined(OS_POSIX)
74 74
75 // N.B. OS_WIN is defined by including src/base headers. 75 // N.B. OS_WIN is defined by including src/base headers.
76 #if defined(OS_WIN) 76 #if defined(OS_WIN)
77 #include <commctrl.h> 77 #include <commctrl.h>
78 #include "remoting/host/win/session_desktop_environment_factory.h"
78 #endif // defined(OS_WIN) 79 #endif // defined(OS_WIN)
79 80
80 #if defined(TOOLKIT_GTK) 81 #if defined(TOOLKIT_GTK)
81 #include "ui/gfx/gtk_util.h" 82 #include "ui/gfx/gtk_util.h"
82 #endif // defined(TOOLKIT_GTK) 83 #endif // defined(TOOLKIT_GTK)
83 84
84 namespace { 85 namespace {
85 86
86 // This is used for tagging system event logs. 87 // This is used for tagging system event logs.
87 const char kApplicationName[] = "chromoting"; 88 const char kApplicationName[] = "chromoting";
(...skipping 25 matching lines...) Expand all
113 : context_(context.Pass()), 114 : context_(context.Pass()),
114 config_(FilePath()), 115 config_(FilePath()),
115 #ifdef OFFICIAL_BUILD 116 #ifdef OFFICIAL_BUILD
116 oauth_use_official_client_id_(true), 117 oauth_use_official_client_id_(true),
117 #else 118 #else
118 oauth_use_official_client_id_(false), 119 oauth_use_official_client_id_(false),
119 #endif 120 #endif
120 allow_nat_traversal_(true), 121 allow_nat_traversal_(true),
121 restarting_(false), 122 restarting_(false),
122 shutting_down_(false), 123 shutting_down_(false),
124 #if defined(OS_WIN)
125 desktop_environment_factory_(new SessionDesktopEnvironmentFactory()),
126 #else // !defined(OS_WIN)
127 desktop_environment_factory_(new DesktopEnvironmentFactory()),
128 #endif // !defined(OS_WIN)
123 exit_code_(kSuccessExitCode) 129 exit_code_(kSuccessExitCode)
124 #if defined(OS_MACOSX) 130 #if defined(OS_MACOSX)
125 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested, 131 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested,
126 base::Unretained(this)), 132 base::Unretained(this)),
127 base::Bind(&HostProcess::OnDisconnectRequested, 133 base::Bind(&HostProcess::OnDisconnectRequested,
128 base::Unretained(this))) 134 base::Unretained(this)))
129 #endif 135 #endif
130 { 136 {
131 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); 137 network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
132 } 138 }
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 client_info = official_client_info; 536 client_info = official_client_info;
531 } 537 }
532 #endif // OFFICIAL_BUILD 538 #endif // OFFICIAL_BUILD
533 539
534 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials( 540 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials(
535 new SignalingConnector::OAuthCredentials( 541 new SignalingConnector::OAuthCredentials(
536 xmpp_login_, oauth_refresh_token_, client_info)); 542 xmpp_login_, oauth_refresh_token_, client_info));
537 signaling_connector_->EnableOAuth(oauth_credentials.Pass()); 543 signaling_connector_->EnableOAuth(oauth_credentials.Pass());
538 } 544 }
539 545
540 if (!desktop_environment_.get()) {
541 desktop_environment_ =
542 DesktopEnvironment::CreateForService(context_.get());
543 }
544
545 NetworkSettings network_settings( 546 NetworkSettings network_settings(
546 allow_nat_traversal_ ? 547 allow_nat_traversal_ ?
547 NetworkSettings::NAT_TRAVERSAL_ENABLED : 548 NetworkSettings::NAT_TRAVERSAL_ENABLED :
548 NetworkSettings::NAT_TRAVERSAL_DISABLED); 549 NetworkSettings::NAT_TRAVERSAL_DISABLED);
549 if (!allow_nat_traversal_) { 550 if (!allow_nat_traversal_) {
550 network_settings.min_port = NetworkSettings::kDefaultMinPort; 551 network_settings.min_port = NetworkSettings::kDefaultMinPort;
551 network_settings.max_port = NetworkSettings::kDefaultMaxPort; 552 network_settings.max_port = NetworkSettings::kDefaultMaxPort;
552 } 553 }
553 554
554 host_ = new ChromotingHost( 555 host_ = new ChromotingHost(
555 context_.get(), signal_strategy_.get(), desktop_environment_.get(), 556 context_.get(), signal_strategy_.get(),
557 desktop_environment_factory_.get(),
556 CreateHostSessionManager(network_settings, 558 CreateHostSessionManager(network_settings,
557 context_->url_request_context_getter())); 559 context_->url_request_context_getter()));
558 560
559 // TODO(simonmorris): Get the maximum session duration from a policy. 561 // TODO(simonmorris): Get the maximum session duration from a policy.
560 #if defined(OS_LINUX) 562 #if defined(OS_LINUX)
561 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); 563 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20));
562 #endif 564 #endif
563 565
564 heartbeat_sender_.reset(new HeartbeatSender( 566 heartbeat_sender_.reset(new HeartbeatSender(
565 this, host_id_, signal_strategy_.get(), &key_pair_)); 567 this, host_id_, signal_strategy_.get(), &key_pair_));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 // Complete the rest of shutdown on the main thread. 645 // Complete the rest of shutdown on the main thread.
644 context_->ui_task_runner()->PostTask( 646 context_->ui_task_runner()->PostTask(
645 FROM_HERE, 647 FROM_HERE,
646 base::Bind(&HostProcess::ShutdownHostProcess, 648 base::Bind(&HostProcess::ShutdownHostProcess,
647 base::Unretained(this))); 649 base::Unretained(this)));
648 } 650 }
649 651
650 void ResetHost() { 652 void ResetHost() {
651 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 653 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
652 654
653 desktop_environment_.reset();
654 host_event_logger_.reset(); 655 host_event_logger_.reset();
655 log_to_server_.reset(); 656 log_to_server_.reset();
656 heartbeat_sender_.reset(); 657 heartbeat_sender_.reset();
657 signaling_connector_.reset(); 658 signaling_connector_.reset();
658 signal_strategy_.reset(); 659 signal_strategy_.reset();
659 } 660 }
660 661
661 scoped_ptr<ChromotingHostContext> context_; 662 scoped_ptr<ChromotingHostContext> context_;
662 scoped_ptr<IPC::ChannelProxy> daemon_channel_; 663 scoped_ptr<IPC::ChannelProxy> daemon_channel_;
663 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; 664 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
(...skipping 14 matching lines...) Expand all
678 std::string oauth_refresh_token_; 679 std::string oauth_refresh_token_;
679 bool oauth_use_official_client_id_; 680 bool oauth_use_official_client_id_;
680 681
681 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; 682 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_;
682 bool allow_nat_traversal_; 683 bool allow_nat_traversal_;
683 std::string talkgadget_prefix_; 684 std::string talkgadget_prefix_;
684 685
685 bool restarting_; 686 bool restarting_;
686 bool shutting_down_; 687 bool shutting_down_;
687 688
689 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
688 scoped_ptr<XmppSignalStrategy> signal_strategy_; 690 scoped_ptr<XmppSignalStrategy> signal_strategy_;
689 scoped_ptr<SignalingConnector> signaling_connector_; 691 scoped_ptr<SignalingConnector> signaling_connector_;
690 scoped_ptr<DesktopEnvironment> desktop_environment_;
691 scoped_ptr<HeartbeatSender> heartbeat_sender_; 692 scoped_ptr<HeartbeatSender> heartbeat_sender_;
692 scoped_ptr<LogToServer> log_to_server_; 693 scoped_ptr<LogToServer> log_to_server_;
693 scoped_ptr<HostEventLogger> host_event_logger_; 694 scoped_ptr<HostEventLogger> host_event_logger_;
694 695
695 #if defined(OS_MACOSX) || defined(OS_WIN) 696 #if defined(OS_MACOSX) || defined(OS_WIN)
696 scoped_ptr<HostUserInterface> host_user_interface_; 697 scoped_ptr<HostUserInterface> host_user_interface_;
697 #endif 698 #endif
698 699
699 scoped_refptr<ChromotingHost> host_; 700 scoped_refptr<ChromotingHost> host_;
700 701
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 user32.GetFunctionPointer("SetProcessDPIAware")); 806 user32.GetFunctionPointer("SetProcessDPIAware"));
806 set_process_dpi_aware(); 807 set_process_dpi_aware();
807 } 808 }
808 809
809 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting 810 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting
810 // the command line from GetCommandLineW(), so we can safely pass NULL here. 811 // the command line from GetCommandLineW(), so we can safely pass NULL here.
811 return main(0, NULL); 812 return main(0, NULL);
812 } 813 }
813 814
814 #endif // defined(OS_WIN) 815 #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