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

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

Issue 422503004: Adding ability to stream windows and inject events to them (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: compiler issues Created 6 years, 4 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
« no previous file with comments | « remoting/host/host_main.cc ('k') | remoting/host/single_window_desktop_environment.h » ('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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "remoting/host/ipc_constants.h" 58 #include "remoting/host/ipc_constants.h"
59 #include "remoting/host/ipc_desktop_environment.h" 59 #include "remoting/host/ipc_desktop_environment.h"
60 #include "remoting/host/ipc_host_event_logger.h" 60 #include "remoting/host/ipc_host_event_logger.h"
61 #include "remoting/host/json_host_config.h" 61 #include "remoting/host/json_host_config.h"
62 #include "remoting/host/logging.h" 62 #include "remoting/host/logging.h"
63 #include "remoting/host/me2me_desktop_environment.h" 63 #include "remoting/host/me2me_desktop_environment.h"
64 #include "remoting/host/pairing_registry_delegate.h" 64 #include "remoting/host/pairing_registry_delegate.h"
65 #include "remoting/host/policy_hack/policy_watcher.h" 65 #include "remoting/host/policy_hack/policy_watcher.h"
66 #include "remoting/host/session_manager_factory.h" 66 #include "remoting/host/session_manager_factory.h"
67 #include "remoting/host/signaling_connector.h" 67 #include "remoting/host/signaling_connector.h"
68 #include "remoting/host/single_window_desktop_environment.h"
68 #include "remoting/host/token_validator_factory_impl.h" 69 #include "remoting/host/token_validator_factory_impl.h"
69 #include "remoting/host/usage_stats_consent.h" 70 #include "remoting/host/usage_stats_consent.h"
70 #include "remoting/host/username.h" 71 #include "remoting/host/username.h"
71 #include "remoting/host/video_frame_recorder_host_extension.h" 72 #include "remoting/host/video_frame_recorder_host_extension.h"
72 #include "remoting/protocol/me2me_host_authenticator_factory.h" 73 #include "remoting/protocol/me2me_host_authenticator_factory.h"
73 #include "remoting/protocol/network_settings.h" 74 #include "remoting/protocol/network_settings.h"
74 #include "remoting/protocol/pairing_registry.h" 75 #include "remoting/protocol/pairing_registry.h"
75 #include "remoting/protocol/token_validator.h" 76 #include "remoting/protocol/token_validator.h"
76 #include "remoting/signaling/xmpp_signal_strategy.h" 77 #include "remoting/signaling/xmpp_signal_strategy.h"
77 78
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Command line switch used to enable VP9 encoding. 127 // Command line switch used to enable VP9 encoding.
127 const char kEnableVp9SwitchName[] = "enable-vp9"; 128 const char kEnableVp9SwitchName[] = "enable-vp9";
128 129
129 // Command line switch used to enable and configure the frame-recorder. 130 // Command line switch used to enable and configure the frame-recorder.
130 const char kFrameRecorderBufferKbName[] = "frame-recorder-buffer-kb"; 131 const char kFrameRecorderBufferKbName[] = "frame-recorder-buffer-kb";
131 132
132 // Value used for --host-config option to indicate that the path must be read 133 // Value used for --host-config option to indicate that the path must be read
133 // from stdin. 134 // from stdin.
134 const char kStdinConfigPath[] = "-"; 135 const char kStdinConfigPath[] = "-";
135 136
137 const char kWindowIdSwitchName[] = "window-id";
138
136 } // namespace 139 } // namespace
137 140
138 namespace remoting { 141 namespace remoting {
139 142
140 class HostProcess 143 class HostProcess
141 : public ConfigWatcher::Delegate, 144 : public ConfigWatcher::Delegate,
142 public HeartbeatSender::Listener, 145 public HeartbeatSender::Listener,
143 public HostChangeNotificationListener::Listener, 146 public HostChangeNotificationListener::Listener,
144 public IPC::Listener, 147 public IPC::Listener,
145 public base::RefCountedThreadSafe<HostProcess> { 148 public base::RefCountedThreadSafe<HostProcess> {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 bool allow_relay_; 305 bool allow_relay_;
303 int min_udp_port_; 306 int min_udp_port_;
304 int max_udp_port_; 307 int max_udp_port_;
305 std::string talkgadget_prefix_; 308 std::string talkgadget_prefix_;
306 bool allow_pairing_; 309 bool allow_pairing_;
307 310
308 bool curtain_required_; 311 bool curtain_required_;
309 ThirdPartyAuthConfig third_party_auth_config_; 312 ThirdPartyAuthConfig third_party_auth_config_;
310 bool enable_gnubby_auth_; 313 bool enable_gnubby_auth_;
311 314
315 // Boolean to change flow, where ncessary, if we're
316 // capturing a window instead of the entire desktop.
317 bool enable_window_capture_;
318
319 // Used to specify which window to stream, if enabled.
320 webrtc::WindowId window_id_;
321
312 scoped_ptr<OAuthTokenGetter> oauth_token_getter_; 322 scoped_ptr<OAuthTokenGetter> oauth_token_getter_;
313 scoped_ptr<XmppSignalStrategy> signal_strategy_; 323 scoped_ptr<XmppSignalStrategy> signal_strategy_;
314 scoped_ptr<SignalingConnector> signaling_connector_; 324 scoped_ptr<SignalingConnector> signaling_connector_;
315 scoped_ptr<HeartbeatSender> heartbeat_sender_; 325 scoped_ptr<HeartbeatSender> heartbeat_sender_;
316 scoped_ptr<HostStatusSender> host_status_sender_; 326 scoped_ptr<HostStatusSender> host_status_sender_;
317 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_; 327 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_;
318 scoped_ptr<HostStatusLogger> host_status_logger_; 328 scoped_ptr<HostStatusLogger> host_status_logger_;
319 scoped_ptr<HostEventLogger> host_event_logger_; 329 scoped_ptr<HostEventLogger> host_event_logger_;
320 330
321 scoped_ptr<ChromotingHost> host_; 331 scoped_ptr<ChromotingHost> host_;
(...skipping 19 matching lines...) Expand all
341 enable_vp9_(false), 351 enable_vp9_(false),
342 frame_recorder_buffer_size_(0), 352 frame_recorder_buffer_size_(0),
343 host_username_match_required_(false), 353 host_username_match_required_(false),
344 allow_nat_traversal_(true), 354 allow_nat_traversal_(true),
345 allow_relay_(true), 355 allow_relay_(true),
346 min_udp_port_(0), 356 min_udp_port_(0),
347 max_udp_port_(0), 357 max_udp_port_(0),
348 allow_pairing_(true), 358 allow_pairing_(true),
349 curtain_required_(false), 359 curtain_required_(false),
350 enable_gnubby_auth_(false), 360 enable_gnubby_auth_(false),
361 enable_window_capture_(false),
362 window_id_(0),
351 #if defined(REMOTING_MULTI_PROCESS) 363 #if defined(REMOTING_MULTI_PROCESS)
352 desktop_session_connector_(NULL), 364 desktop_session_connector_(NULL),
353 #endif // defined(REMOTING_MULTI_PROCESS) 365 #endif // defined(REMOTING_MULTI_PROCESS)
354 self_(this), 366 self_(this),
355 exit_code_out_(exit_code_out), 367 exit_code_out_(exit_code_out),
356 signal_parent_(false) { 368 signal_parent_(false) {
357 StartOnUiThread(); 369 StartOnUiThread();
358 } 370 }
359 371
360 HostProcess::~HostProcess() { 372 HostProcess::~HostProcess() {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 if (!xmpp_server_valid) { 459 if (!xmpp_server_valid) {
448 LOG(ERROR) << "Invalid XMPP server: " << 460 LOG(ERROR) << "Invalid XMPP server: " <<
449 service_urls->xmpp_server_address(); 461 service_urls->xmpp_server_address();
450 return false; 462 return false;
451 } 463 }
452 xmpp_server_config_.use_tls = service_urls->xmpp_server_use_tls(); 464 xmpp_server_config_.use_tls = service_urls->xmpp_server_use_tls();
453 directory_bot_jid_ = service_urls->directory_bot_jid(); 465 directory_bot_jid_ = service_urls->directory_bot_jid();
454 466
455 signal_parent_ = cmd_line->HasSwitch(kSignalParentSwitchName); 467 signal_parent_ = cmd_line->HasSwitch(kSignalParentSwitchName);
456 468
469 enable_window_capture_ = cmd_line->HasSwitch(kWindowIdSwitchName);
470 if (enable_window_capture_) {
471
472 #if defined(OS_LINUX) || defined(OS_WIN)
473 LOG(WARNING) << "Window capturing is not fully supported on Linux or "
474 "Windows.";
475 #endif // defined(OS_LINUX) || defined(OS_WIN)
476
477 // uint32_t is large enough to hold window IDs on all platforms.
478 uint32_t window_id;
479 if (base::StringToUint(
480 cmd_line->GetSwitchValueASCII(kWindowIdSwitchName),
481 &window_id)) {
482 window_id_ = static_cast<webrtc::WindowId>(window_id);
483 } else {
484 LOG(ERROR) << "Window with window id: " << window_id_
485 << " not found. Shutting down host.";
486 return false;
487 }
488 }
457 return true; 489 return true;
458 } 490 }
459 491
460 void HostProcess::OnConfigUpdated( 492 void HostProcess::OnConfigUpdated(
461 const std::string& serialized_config) { 493 const std::string& serialized_config) {
462 if (!context_->network_task_runner()->BelongsToCurrentThread()) { 494 if (!context_->network_task_runner()->BelongsToCurrentThread()) {
463 context_->network_task_runner()->PostTask(FROM_HERE, 495 context_->network_task_runner()->PostTask(FROM_HERE,
464 base::Bind(&HostProcess::OnConfigUpdated, this, serialized_config)); 496 base::Bind(&HostProcess::OnConfigUpdated, this, serialized_config));
465 return; 497 return;
466 } 498 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 #if defined(OS_WIN) 709 #if defined(OS_WIN)
678 IpcDesktopEnvironmentFactory* desktop_environment_factory = 710 IpcDesktopEnvironmentFactory* desktop_environment_factory =
679 new IpcDesktopEnvironmentFactory( 711 new IpcDesktopEnvironmentFactory(
680 context_->audio_task_runner(), 712 context_->audio_task_runner(),
681 context_->network_task_runner(), 713 context_->network_task_runner(),
682 context_->video_capture_task_runner(), 714 context_->video_capture_task_runner(),
683 context_->network_task_runner(), 715 context_->network_task_runner(),
684 daemon_channel_.get()); 716 daemon_channel_.get());
685 desktop_session_connector_ = desktop_environment_factory; 717 desktop_session_connector_ = desktop_environment_factory;
686 #else // !defined(OS_WIN) 718 #else // !defined(OS_WIN)
687 DesktopEnvironmentFactory* desktop_environment_factory = 719 DesktopEnvironmentFactory* desktop_environment_factory;
720 if (enable_window_capture_) {
721 desktop_environment_factory =
722 new SingleWindowDesktopEnvironmentFactory(
723 context_->network_task_runner(),
724 context_->input_task_runner(),
725 context_->ui_task_runner(),
726 window_id_);
727 } else {
728 desktop_environment_factory =
688 new Me2MeDesktopEnvironmentFactory( 729 new Me2MeDesktopEnvironmentFactory(
689 context_->network_task_runner(), 730 context_->network_task_runner(),
690 context_->input_task_runner(), 731 context_->input_task_runner(),
691 context_->ui_task_runner()); 732 context_->ui_task_runner());
733 }
692 #endif // !defined(OS_WIN) 734 #endif // !defined(OS_WIN)
693 735
694 desktop_environment_factory_.reset(desktop_environment_factory); 736 desktop_environment_factory_.reset(desktop_environment_factory);
695 desktop_environment_factory_->SetEnableGnubbyAuth(enable_gnubby_auth_); 737 desktop_environment_factory_->SetEnableGnubbyAuth(enable_gnubby_auth_);
696 738
697 context_->network_task_runner()->PostTask( 739 context_->network_task_runner()->PostTask(
698 FROM_HERE, 740 FROM_HERE,
699 base::Bind(&HostProcess::StartOnNetworkThread, this)); 741 base::Bind(&HostProcess::StartOnNetworkThread, this));
700 } 742 }
701 743
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 int exit_code = kSuccessExitCode; 1444 int exit_code = kSuccessExitCode;
1403 new HostProcess(context.Pass(), &exit_code); 1445 new HostProcess(context.Pass(), &exit_code);
1404 1446
1405 // Run the main (also UI) message loop until the host no longer needs it. 1447 // Run the main (also UI) message loop until the host no longer needs it.
1406 message_loop.Run(); 1448 message_loop.Run();
1407 1449
1408 return exit_code; 1450 return exit_code;
1409 } 1451 }
1410 1452
1411 } // namespace remoting 1453 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/host_main.cc ('k') | remoting/host/single_window_desktop_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698