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

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: removed unnecessary include 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 if (!xmpp_server_valid) { 457 if (!xmpp_server_valid) {
448 LOG(ERROR) << "Invalid XMPP server: " << 458 LOG(ERROR) << "Invalid XMPP server: " <<
449 service_urls->xmpp_server_address(); 459 service_urls->xmpp_server_address();
450 return false; 460 return false;
451 } 461 }
452 xmpp_server_config_.use_tls = service_urls->xmpp_server_use_tls(); 462 xmpp_server_config_.use_tls = service_urls->xmpp_server_use_tls();
453 directory_bot_jid_ = service_urls->directory_bot_jid(); 463 directory_bot_jid_ = service_urls->directory_bot_jid();
454 464
455 signal_parent_ = cmd_line->HasSwitch(kSignalParentSwitchName); 465 signal_parent_ = cmd_line->HasSwitch(kSignalParentSwitchName);
456 466
467 enable_window_capture_ = cmd_line->HasSwitch(kWindowIdSwitchName);
468 if (enable_window_capture_) {
469
470 #if defined(OS_LINUX)
Sergey Ulanov 2014/08/13 21:27:14 #if doesn't need to be indented.
ronakvora do not use 2014/08/13 22:02:08 Done.
471 LOG(WARNING) << "Window capturing is not fully supported on Linux.";
472 #endif // defined(OS_LINUX)
473
474 #if defined(OS_WIN)
Sergey Ulanov 2014/08/13 21:27:14 nit: No need to have two separate messages. It's b
ronakvora do not use 2014/08/13 22:02:08 Done.
475 LOG(WARNING) << "Window capturing is not fully supported on Windows.";
476 #endif // defined(OS_WIN)
477
478 // uint32_t is large enough to hold window IDs on all platforms.
479 uint32_t window_id;
480 if (base::StringToUint(
481 cmd_line->GetSwitchValueASCII(kWindowIdSwitchName),
482 &window_id)) {
483 window_id_ = static_cast<webrtc::WindowId>(window_id);
484 } else {
485 LOG(ERROR) << "Window with window id: " << window_id_
486 << " not found. Shutting down host.";
487 return false;
488 }
489 }
457 return true; 490 return true;
458 } 491 }
459 492
460 void HostProcess::OnConfigUpdated( 493 void HostProcess::OnConfigUpdated(
461 const std::string& serialized_config) { 494 const std::string& serialized_config) {
462 if (!context_->network_task_runner()->BelongsToCurrentThread()) { 495 if (!context_->network_task_runner()->BelongsToCurrentThread()) {
463 context_->network_task_runner()->PostTask(FROM_HERE, 496 context_->network_task_runner()->PostTask(FROM_HERE,
464 base::Bind(&HostProcess::OnConfigUpdated, this, serialized_config)); 497 base::Bind(&HostProcess::OnConfigUpdated, this, serialized_config));
465 return; 498 return;
466 } 499 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 #if defined(OS_WIN) 710 #if defined(OS_WIN)
678 IpcDesktopEnvironmentFactory* desktop_environment_factory = 711 IpcDesktopEnvironmentFactory* desktop_environment_factory =
679 new IpcDesktopEnvironmentFactory( 712 new IpcDesktopEnvironmentFactory(
680 context_->audio_task_runner(), 713 context_->audio_task_runner(),
681 context_->network_task_runner(), 714 context_->network_task_runner(),
682 context_->video_capture_task_runner(), 715 context_->video_capture_task_runner(),
683 context_->network_task_runner(), 716 context_->network_task_runner(),
684 daemon_channel_.get()); 717 daemon_channel_.get());
685 desktop_session_connector_ = desktop_environment_factory; 718 desktop_session_connector_ = desktop_environment_factory;
686 #else // !defined(OS_WIN) 719 #else // !defined(OS_WIN)
687 DesktopEnvironmentFactory* desktop_environment_factory = 720 DesktopEnvironmentFactory* desktop_environment_factory;
721 if (enable_window_capture_) {
722 desktop_environment_factory =
723 new SingleWindowDesktopEnvironmentFactory(
724 context_->network_task_runner(),
725 context_->input_task_runner(),
726 context_->ui_task_runner(),
727 window_id_);
728 } else {
729 desktop_environment_factory =
688 new Me2MeDesktopEnvironmentFactory( 730 new Me2MeDesktopEnvironmentFactory(
689 context_->network_task_runner(), 731 context_->network_task_runner(),
690 context_->input_task_runner(), 732 context_->input_task_runner(),
691 context_->ui_task_runner()); 733 context_->ui_task_runner());
734 }
692 #endif // !defined(OS_WIN) 735 #endif // !defined(OS_WIN)
693 736
694 desktop_environment_factory_.reset(desktop_environment_factory); 737 desktop_environment_factory_.reset(desktop_environment_factory);
695 desktop_environment_factory_->SetEnableGnubbyAuth(enable_gnubby_auth_); 738 desktop_environment_factory_->SetEnableGnubbyAuth(enable_gnubby_auth_);
696 739
697 context_->network_task_runner()->PostTask( 740 context_->network_task_runner()->PostTask(
698 FROM_HERE, 741 FROM_HERE,
699 base::Bind(&HostProcess::StartOnNetworkThread, this)); 742 base::Bind(&HostProcess::StartOnNetworkThread, this));
700 } 743 }
701 744
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 int exit_code = kSuccessExitCode; 1445 int exit_code = kSuccessExitCode;
1403 new HostProcess(context.Pass(), &exit_code); 1446 new HostProcess(context.Pass(), &exit_code);
1404 1447
1405 // Run the main (also UI) message loop until the host no longer needs it. 1448 // Run the main (also UI) message loop until the host no longer needs it.
1406 message_loop.Run(); 1449 message_loop.Run();
1407 1450
1408 return exit_code; 1451 return exit_code;
1409 } 1452 }
1410 1453
1411 } // namespace remoting 1454 } // 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