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

Side by Side Diff: remoting/host/simple_host_process.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
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 is an application of a minimal host process in a Chromoting 5 // This is an application of a minimal host process in a Chromoting
6 // system. It serves the purpose of gluing different pieces together 6 // system. It serves the purpose of gluing different pieces together
7 // to make a functional host process for testing. 7 // to make a functional host process for testing.
8 // 8 //
9 // It peforms the following functionality: 9 // It peforms the following functionality:
10 // 1. Connect to the GTalk network and register the machine as a host. 10 // 1. Connect to the GTalk network and register the machine as a host.
(...skipping 23 matching lines...) Expand all
34 #include "net/socket/ssl_server_socket.h" 34 #include "net/socket/ssl_server_socket.h"
35 #include "remoting/base/auto_thread_task_runner.h" 35 #include "remoting/base/auto_thread_task_runner.h"
36 #include "remoting/base/constants.h" 36 #include "remoting/base/constants.h"
37 #include "remoting/host/audio_capturer.h" 37 #include "remoting/host/audio_capturer.h"
38 #include "remoting/host/chromoting_host_context.h" 38 #include "remoting/host/chromoting_host_context.h"
39 #include "remoting/host/chromoting_host.h" 39 #include "remoting/host/chromoting_host.h"
40 #include "remoting/host/constants.h" 40 #include "remoting/host/constants.h"
41 #include "remoting/host/desktop_environment.h" 41 #include "remoting/host/desktop_environment.h"
42 #include "remoting/host/dns_blackhole_checker.h" 42 #include "remoting/host/dns_blackhole_checker.h"
43 #include "remoting/host/event_executor.h" 43 #include "remoting/host/event_executor.h"
44 #include "remoting/host/desktop_environment.h"
45 #include "remoting/host/desktop_environment_factory.h"
46 #include "remoting/host/heartbeat_sender.h" 44 #include "remoting/host/heartbeat_sender.h"
47 #include "remoting/host/host_key_pair.h" 45 #include "remoting/host/host_key_pair.h"
48 #include "remoting/host/host_secret.h" 46 #include "remoting/host/host_secret.h"
49 #include "remoting/host/it2me_host_user_interface.h" 47 #include "remoting/host/it2me_host_user_interface.h"
50 #include "remoting/host/json_host_config.h" 48 #include "remoting/host/json_host_config.h"
51 #include "remoting/host/log_to_server.h" 49 #include "remoting/host/log_to_server.h"
52 #include "remoting/host/network_settings.h" 50 #include "remoting/host/network_settings.h"
53 #include "remoting/host/register_support_host_request.h" 51 #include "remoting/host/register_support_host_request.h"
54 #include "remoting/host/session_manager_factory.h" 52 #include "remoting/host/session_manager_factory.h"
55 #include "remoting/host/signaling_connector.h" 53 #include "remoting/host/signaling_connector.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 const char kMaxPortSwitchName[] = "max-port"; 87 const char kMaxPortSwitchName[] = "max-port";
90 88
91 const char kVideoSwitchValueVerbatim[] = "verbatim"; 89 const char kVideoSwitchValueVerbatim[] = "verbatim";
92 const char kVideoSwitchValueZip[] = "zip"; 90 const char kVideoSwitchValueZip[] = "zip";
93 const char kVideoSwitchValueVp8[] = "vp8"; 91 const char kVideoSwitchValueVp8[] = "vp8";
94 92
95 } // namespace 93 } // namespace
96 94
97 namespace remoting { 95 namespace remoting {
98 96
99 class FakeDesktopEnvironmentFactory : public DesktopEnvironmentFactory {
100 public:
101 FakeDesktopEnvironmentFactory();
102 virtual ~FakeDesktopEnvironmentFactory();
103
104 virtual scoped_ptr<DesktopEnvironment> Create(
105 ChromotingHostContext* context) OVERRIDE;
106
107 DISALLOW_COPY_AND_ASSIGN(FakeDesktopEnvironmentFactory);
108 };
109
110 FakeDesktopEnvironmentFactory::FakeDesktopEnvironmentFactory() {
111 }
112
113 FakeDesktopEnvironmentFactory::~FakeDesktopEnvironmentFactory() {
114 }
115
116 scoped_ptr<DesktopEnvironment> FakeDesktopEnvironmentFactory::Create(
117 ChromotingHostContext* context) {
118 scoped_ptr<VideoFrameCapturer> capturer(new VideoFrameCapturerFake());
119 scoped_ptr<EventExecutor> event_executor = EventExecutor::Create(
120 context->desktop_task_runner(),
121 context->ui_task_runner());
122 scoped_ptr<AudioCapturer> audio_capturer(NULL);
123 return scoped_ptr<DesktopEnvironment>(new DesktopEnvironment(
124 audio_capturer.Pass(),
125 event_executor.Pass(),
126 capturer.Pass()));
127 }
128
129 class SimpleHost : public HeartbeatSender::Listener { 97 class SimpleHost : public HeartbeatSender::Listener {
130 public: 98 public:
131 SimpleHost() 99 SimpleHost()
132 : message_loop_(MessageLoop::TYPE_UI), 100 : message_loop_(MessageLoop::TYPE_UI),
133 context_(new AutoThreadTaskRunner(message_loop_.message_loop_proxy())), 101 context_(new AutoThreadTaskRunner(message_loop_.message_loop_proxy())),
134 fake_(false), 102 fake_(false),
135 is_it2me_(false), 103 is_it2me_(false),
136 shutting_down_(false), 104 shutting_down_(false),
137 exit_code_(kSuccessExitCode) { 105 exit_code_(kSuccessExitCode) {
138 context_.Start(); 106 context_.Start();
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 signal_strategy_.reset(new XmppSignalStrategy( 222 signal_strategy_.reset(new XmppSignalStrategy(
255 context_.url_request_context_getter(), 223 context_.url_request_context_getter(),
256 xmpp_login_, xmpp_auth_token_, xmpp_auth_service_)); 224 xmpp_login_, xmpp_auth_token_, xmpp_auth_service_));
257 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker( 225 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker(
258 new DnsBlackholeChecker(&context_, kDefaultHostTalkGadgetPrefix)); 226 new DnsBlackholeChecker(&context_, kDefaultHostTalkGadgetPrefix));
259 signaling_connector_.reset(new SignalingConnector( 227 signaling_connector_.reset(new SignalingConnector(
260 signal_strategy_.get(), &context_, dns_blackhole_checker.Pass(), 228 signal_strategy_.get(), &context_, dns_blackhole_checker.Pass(),
261 base::Bind(&SimpleHost::OnAuthFailed, base::Unretained(this)))); 229 base::Bind(&SimpleHost::OnAuthFailed, base::Unretained(this))));
262 230
263 if (fake_) { 231 if (fake_) {
264 desktop_environment_factory_.reset(new FakeDesktopEnvironmentFactory()); 232 scoped_ptr<VideoFrameCapturer> capturer(new VideoFrameCapturerFake());
233 scoped_ptr<EventExecutor> event_executor = EventExecutor::Create(
234 context_.desktop_task_runner(),
235 context_.ui_task_runner());
236 scoped_ptr<AudioCapturer> audio_capturer(NULL);
237 desktop_environment_ = DesktopEnvironment::CreateFake(
238 &context_,
239 capturer.Pass(),
240 event_executor.Pass(),
241 audio_capturer.Pass());
265 } else { 242 } else {
266 desktop_environment_factory_.reset(new DesktopEnvironmentFactory()); 243 desktop_environment_ = DesktopEnvironment::Create(&context_);
267 } 244 }
268 245
269 host_ = new ChromotingHost( 246 host_ = new ChromotingHost(
270 &context_, signal_strategy_.get(), desktop_environment_factory_.get(), 247 &context_, signal_strategy_.get(), desktop_environment_.get(),
271 CreateHostSessionManager(network_settings_, 248 CreateHostSessionManager(network_settings_,
272 context_.url_request_context_getter())); 249 context_.url_request_context_getter()));
273 250
274 ServerLogEntry::Mode mode = 251 ServerLogEntry::Mode mode =
275 is_it2me_ ? ServerLogEntry::IT2ME : ServerLogEntry::ME2ME; 252 is_it2me_ ? ServerLogEntry::IT2ME : ServerLogEntry::ME2ME;
276 log_to_server_.reset(new LogToServer(host_, mode, signal_strategy_.get())); 253 log_to_server_.reset(new LogToServer(host_, mode, signal_strategy_.get()));
277 254
278 if (is_it2me_) { 255 if (is_it2me_) {
279 it2me_host_user_interface_.reset(new It2MeHostUserInterface(&context_)); 256 it2me_host_user_interface_.reset(new It2MeHostUserInterface(&context_));
280 it2me_host_user_interface_->Start( 257 it2me_host_user_interface_->Start(
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 NetworkSettings network_settings_; 324 NetworkSettings network_settings_;
348 scoped_ptr<CandidateSessionConfig> protocol_config_; 325 scoped_ptr<CandidateSessionConfig> protocol_config_;
349 326
350 std::string host_id_; 327 std::string host_id_;
351 HostKeyPair key_pair_; 328 HostKeyPair key_pair_;
352 protocol::SharedSecretHash host_secret_hash_; 329 protocol::SharedSecretHash host_secret_hash_;
353 std::string xmpp_login_; 330 std::string xmpp_login_;
354 std::string xmpp_auth_token_; 331 std::string xmpp_auth_token_;
355 std::string xmpp_auth_service_; 332 std::string xmpp_auth_service_;
356 333
357 scoped_ptr<DesktopEnvironmentFactory> desktop_environment_factory_;
358 scoped_ptr<XmppSignalStrategy> signal_strategy_; 334 scoped_ptr<XmppSignalStrategy> signal_strategy_;
359 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker_; 335 scoped_ptr<DnsBlackholeChecker> dns_blackhole_checker_;
360 scoped_ptr<SignalingConnector> signaling_connector_; 336 scoped_ptr<SignalingConnector> signaling_connector_;
337 scoped_ptr<DesktopEnvironment> desktop_environment_;
361 scoped_ptr<LogToServer> log_to_server_; 338 scoped_ptr<LogToServer> log_to_server_;
362 scoped_ptr<It2MeHostUserInterface> it2me_host_user_interface_; 339 scoped_ptr<It2MeHostUserInterface> it2me_host_user_interface_;
363 scoped_ptr<RegisterSupportHostRequest> register_request_; 340 scoped_ptr<RegisterSupportHostRequest> register_request_;
364 scoped_ptr<HeartbeatSender> heartbeat_sender_; 341 scoped_ptr<HeartbeatSender> heartbeat_sender_;
365 342
366 scoped_refptr<ChromotingHost> host_; 343 scoped_refptr<ChromotingHost> host_;
367 344
368 bool shutting_down_; 345 bool shutting_down_;
369 int exit_code_; 346 int exit_code_;
370 }; 347 };
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 max_port < 0 || max_port > 65535) { 438 max_port < 0 || max_port > 65535) {
462 LOG(ERROR) << "Invalid max-port value: " << max_port 439 LOG(ERROR) << "Invalid max-port value: " << max_port
463 << ". Expected integer in range [0, 65535]."; 440 << ". Expected integer in range [0, 65535].";
464 return 1; 441 return 1;
465 } 442 }
466 simple_host.network_settings()->max_port = max_port; 443 simple_host.network_settings()->max_port = max_port;
467 } 444 }
468 445
469 return simple_host.Run(); 446 return simple_host.Run();
470 } 447 }
OLDNEW
« no previous file with comments | « remoting/host/session_event_executor_win.cc ('k') | remoting/host/win/session_desktop_environment_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698