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

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

Issue 10916161: Revert 155219 - [Chromoting] Refactoring DesktopEnvironment and moving screen/audio recorders to Cl… (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
« 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_factory.h" 40 #include "remoting/host/desktop_environment.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"
72 #endif // defined(OS_WIN) 71 #endif // defined(OS_WIN)
73 72
74 #if defined(TOOLKIT_GTK) 73 #if defined(TOOLKIT_GTK)
75 #include "ui/gfx/gtk_util.h" 74 #include "ui/gfx/gtk_util.h"
76 #endif // defined(TOOLKIT_GTK) 75 #endif // defined(TOOLKIT_GTK)
77 76
78 namespace { 77 namespace {
79 78
80 // This is used for tagging system event logs. 79 // This is used for tagging system event logs.
81 const char kApplicationName[] = "chromoting"; 80 const char kApplicationName[] = "chromoting";
(...skipping 22 matching lines...) Expand all
104 : context_(context.Pass()), 103 : context_(context.Pass()),
105 config_(FilePath()), 104 config_(FilePath()),
106 #ifdef OFFICIAL_BUILD 105 #ifdef OFFICIAL_BUILD
107 oauth_use_official_client_id_(true), 106 oauth_use_official_client_id_(true),
108 #else 107 #else
109 oauth_use_official_client_id_(false), 108 oauth_use_official_client_id_(false),
110 #endif 109 #endif
111 allow_nat_traversal_(true), 110 allow_nat_traversal_(true),
112 restarting_(false), 111 restarting_(false),
113 shutting_down_(false), 112 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)
119 exit_code_(kSuccessExitCode) 113 exit_code_(kSuccessExitCode)
120 #if defined(OS_MACOSX) 114 #if defined(OS_MACOSX)
121 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested, 115 , curtain_(base::Bind(&HostProcess::OnDisconnectRequested,
122 base::Unretained(this)), 116 base::Unretained(this)),
123 base::Bind(&HostProcess::OnDisconnectRequested, 117 base::Bind(&HostProcess::OnDisconnectRequested,
124 base::Unretained(this))) 118 base::Unretained(this)))
125 #endif 119 #endif
126 { 120 {
127 network_change_notifier_.reset(net::NetworkChangeNotifier::Create()); 121 network_change_notifier_.reset(net::NetworkChangeNotifier::Create());
128 } 122 }
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 client_info = official_client_info; 506 client_info = official_client_info;
513 } 507 }
514 #endif // OFFICIAL_BUILD 508 #endif // OFFICIAL_BUILD
515 509
516 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials( 510 scoped_ptr<SignalingConnector::OAuthCredentials> oauth_credentials(
517 new SignalingConnector::OAuthCredentials( 511 new SignalingConnector::OAuthCredentials(
518 xmpp_login_, oauth_refresh_token_, client_info)); 512 xmpp_login_, oauth_refresh_token_, client_info));
519 signaling_connector_->EnableOAuth(oauth_credentials.Pass()); 513 signaling_connector_->EnableOAuth(oauth_credentials.Pass());
520 } 514 }
521 515
516 if (!desktop_environment_.get()) {
517 desktop_environment_ =
518 DesktopEnvironment::CreateForService(context_.get());
519 }
520
522 NetworkSettings network_settings( 521 NetworkSettings network_settings(
523 allow_nat_traversal_ ? 522 allow_nat_traversal_ ?
524 NetworkSettings::NAT_TRAVERSAL_ENABLED : 523 NetworkSettings::NAT_TRAVERSAL_ENABLED :
525 NetworkSettings::NAT_TRAVERSAL_DISABLED); 524 NetworkSettings::NAT_TRAVERSAL_DISABLED);
526 if (!allow_nat_traversal_) { 525 if (!allow_nat_traversal_) {
527 network_settings.min_port = NetworkSettings::kDefaultMinPort; 526 network_settings.min_port = NetworkSettings::kDefaultMinPort;
528 network_settings.max_port = NetworkSettings::kDefaultMaxPort; 527 network_settings.max_port = NetworkSettings::kDefaultMaxPort;
529 } 528 }
530 529
531 host_ = new ChromotingHost( 530 host_ = new ChromotingHost(
532 context_.get(), signal_strategy_.get(), 531 context_.get(), signal_strategy_.get(), desktop_environment_.get(),
533 desktop_environment_factory_.get(),
534 CreateHostSessionManager(network_settings, 532 CreateHostSessionManager(network_settings,
535 context_->url_request_context_getter())); 533 context_->url_request_context_getter()));
536 534
537 // TODO(simonmorris): Get the maximum session duration from a policy. 535 // TODO(simonmorris): Get the maximum session duration from a policy.
538 #if defined(OS_LINUX) 536 #if defined(OS_LINUX)
539 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); 537 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20));
540 #endif 538 #endif
541 539
542 heartbeat_sender_.reset(new HeartbeatSender( 540 heartbeat_sender_.reset(new HeartbeatSender(
543 this, host_id_, signal_strategy_.get(), &key_pair_)); 541 this, host_id_, signal_strategy_.get(), &key_pair_));
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 // Complete the rest of shutdown on the main thread. 619 // Complete the rest of shutdown on the main thread.
622 context_->ui_task_runner()->PostTask( 620 context_->ui_task_runner()->PostTask(
623 FROM_HERE, 621 FROM_HERE,
624 base::Bind(&HostProcess::ShutdownHostProcess, 622 base::Bind(&HostProcess::ShutdownHostProcess,
625 base::Unretained(this))); 623 base::Unretained(this)));
626 } 624 }
627 625
628 void ResetHost() { 626 void ResetHost() {
629 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); 627 DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
630 628
629 desktop_environment_.reset();
631 host_event_logger_.reset(); 630 host_event_logger_.reset();
632 log_to_server_.reset(); 631 log_to_server_.reset();
633 heartbeat_sender_.reset(); 632 heartbeat_sender_.reset();
634 signaling_connector_.reset(); 633 signaling_connector_.reset();
635 signal_strategy_.reset(); 634 signal_strategy_.reset();
636 } 635 }
637 636
638 scoped_ptr<ChromotingHostContext> context_; 637 scoped_ptr<ChromotingHostContext> context_;
639 scoped_ptr<IPC::ChannelProxy> daemon_channel_; 638 scoped_ptr<IPC::ChannelProxy> daemon_channel_;
640 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_; 639 scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
(...skipping 14 matching lines...) Expand all
655 std::string oauth_refresh_token_; 654 std::string oauth_refresh_token_;
656 bool oauth_use_official_client_id_; 655 bool oauth_use_official_client_id_;
657 656
658 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_; 657 scoped_ptr<policy_hack::PolicyWatcher> policy_watcher_;
659 bool allow_nat_traversal_; 658 bool allow_nat_traversal_;
660 std::string talkgadget_prefix_; 659 std::string talkgadget_prefix_;
661 660
662 bool restarting_; 661 bool restarting_;
663 bool shutting_down_; 662 bool shutting_down_;
664 663
665 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
666 scoped_ptr<XmppSignalStrategy> signal_strategy_; 664 scoped_ptr<XmppSignalStrategy> signal_strategy_;
667 scoped_ptr<SignalingConnector> signaling_connector_; 665 scoped_ptr<SignalingConnector> signaling_connector_;
666 scoped_ptr<DesktopEnvironment> desktop_environment_;
668 scoped_ptr<HeartbeatSender> heartbeat_sender_; 667 scoped_ptr<HeartbeatSender> heartbeat_sender_;
669 scoped_ptr<LogToServer> log_to_server_; 668 scoped_ptr<LogToServer> log_to_server_;
670 scoped_ptr<HostEventLogger> host_event_logger_; 669 scoped_ptr<HostEventLogger> host_event_logger_;
671 670
672 #if defined(OS_MACOSX) || defined(OS_WIN) 671 #if defined(OS_MACOSX) || defined(OS_WIN)
673 scoped_ptr<HostUserInterface> host_user_interface_; 672 scoped_ptr<HostUserInterface> host_user_interface_;
674 #endif 673 #endif
675 674
676 scoped_refptr<ChromotingHost> host_; 675 scoped_refptr<ChromotingHost> host_;
677 676
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 user32.GetFunctionPointer("SetProcessDPIAware")); 787 user32.GetFunctionPointer("SetProcessDPIAware"));
789 set_process_dpi_aware(); 788 set_process_dpi_aware();
790 } 789 }
791 790
792 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting 791 // CommandLine::Init() ignores the passed |argc| and |argv| on Windows getting
793 // the command line from GetCommandLineW(), so we can safely pass NULL here. 792 // the command line from GetCommandLineW(), so we can safely pass NULL here.
794 return main(0, NULL); 793 return main(0, NULL);
795 } 794 }
796 795
797 #endif // defined(OS_WIN) 796 #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