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

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: uploaded to remove lint errors 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
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "remoting/host/host_exit_codes.h" 54 #include "remoting/host/host_exit_codes.h"
55 #include "remoting/host/host_main.h" 55 #include "remoting/host/host_main.h"
56 #include "remoting/host/host_status_logger.h" 56 #include "remoting/host/host_status_logger.h"
57 #include "remoting/host/host_status_sender.h" 57 #include "remoting/host/host_status_sender.h"
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/me2me_window_desktop_environment.h"
64 #include "remoting/host/pairing_registry_delegate.h" 65 #include "remoting/host/pairing_registry_delegate.h"
65 #include "remoting/host/policy_hack/policy_watcher.h" 66 #include "remoting/host/policy_hack/policy_watcher.h"
66 #include "remoting/host/session_manager_factory.h" 67 #include "remoting/host/session_manager_factory.h"
67 #include "remoting/host/signaling_connector.h" 68 #include "remoting/host/signaling_connector.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/jingle_glue/network_settings.h" 72 #include "remoting/jingle_glue/network_settings.h"
72 #include "remoting/jingle_glue/xmpp_signal_strategy.h" 73 #include "remoting/jingle_glue/xmpp_signal_strategy.h"
73 #include "remoting/protocol/me2me_host_authenticator_factory.h" 74 #include "remoting/protocol/me2me_host_authenticator_factory.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // when it is successfully started. 121 // when it is successfully started.
121 const char kSignalParentSwitchName[] = "signal-parent"; 122 const char kSignalParentSwitchName[] = "signal-parent";
122 123
123 // Command line switch used to enable VP9 encoding. 124 // Command line switch used to enable VP9 encoding.
124 const char kEnableVp9SwitchName[] = "enable-vp9"; 125 const char kEnableVp9SwitchName[] = "enable-vp9";
125 126
126 // Value used for --host-config option to indicate that the path must be read 127 // Value used for --host-config option to indicate that the path must be read
127 // from stdin. 128 // from stdin.
128 const char kStdinConfigPath[] = "-"; 129 const char kStdinConfigPath[] = "-";
129 130
131 extern const char kWindowIdSwitchName[] = "window-Id";
132
130 } // namespace 133 } // namespace
131 134
132 namespace remoting { 135 namespace remoting {
133 136
134 class HostProcess 137 class HostProcess
135 : public ConfigWatcher::Delegate, 138 : public ConfigWatcher::Delegate,
136 public HeartbeatSender::Listener, 139 public HeartbeatSender::Listener,
137 public HostChangeNotificationListener::Listener, 140 public HostChangeNotificationListener::Listener,
138 public IPC::Listener, 141 public IPC::Listener,
139 public base::RefCountedThreadSafe<HostProcess> { 142 public base::RefCountedThreadSafe<HostProcess> {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 bool allow_relay_; 298 bool allow_relay_;
296 int min_udp_port_; 299 int min_udp_port_;
297 int max_udp_port_; 300 int max_udp_port_;
298 std::string talkgadget_prefix_; 301 std::string talkgadget_prefix_;
299 bool allow_pairing_; 302 bool allow_pairing_;
300 303
301 bool curtain_required_; 304 bool curtain_required_;
302 ThirdPartyAuthConfig third_party_auth_config_; 305 ThirdPartyAuthConfig third_party_auth_config_;
303 bool enable_gnubby_auth_; 306 bool enable_gnubby_auth_;
304 307
308 // Boolean to change flow, where ncessary, if we're
309 // capturing a window instead of the entire desktop.
310 bool enable_window_capture_;
311 // Used to specify which window to stream, if enabled.
312 webrtc::WindowId windowId_;
Lambros 2014/07/30 00:14:49 nit: window_id_
ronakvora do not use 2014/07/30 20:55:36 Done.
313
305 scoped_ptr<OAuthTokenGetter> oauth_token_getter_; 314 scoped_ptr<OAuthTokenGetter> oauth_token_getter_;
306 scoped_ptr<XmppSignalStrategy> signal_strategy_; 315 scoped_ptr<XmppSignalStrategy> signal_strategy_;
307 scoped_ptr<SignalingConnector> signaling_connector_; 316 scoped_ptr<SignalingConnector> signaling_connector_;
308 scoped_ptr<HeartbeatSender> heartbeat_sender_; 317 scoped_ptr<HeartbeatSender> heartbeat_sender_;
309 scoped_ptr<HostStatusSender> host_status_sender_; 318 scoped_ptr<HostStatusSender> host_status_sender_;
310 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_; 319 scoped_ptr<HostChangeNotificationListener> host_change_notification_listener_;
311 scoped_ptr<HostStatusLogger> host_status_logger_; 320 scoped_ptr<HostStatusLogger> host_status_logger_;
312 scoped_ptr<HostEventLogger> host_event_logger_; 321 scoped_ptr<HostEventLogger> host_event_logger_;
313 322
314 scoped_ptr<ChromotingHost> host_; 323 scoped_ptr<ChromotingHost> host_;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 } else { 427 } else {
419 base::FilePath default_config_dir = remoting::GetConfigDir(); 428 base::FilePath default_config_dir = remoting::GetConfigDir();
420 host_config_path_ = default_config_dir.Append(kDefaultHostConfigFile); 429 host_config_path_ = default_config_dir.Append(kDefaultHostConfigFile);
421 } 430 }
422 431
423 if (host_config_path_ != base::FilePath(kStdinConfigPath) && 432 if (host_config_path_ != base::FilePath(kStdinConfigPath) &&
424 !base::PathExists(host_config_path_)) { 433 !base::PathExists(host_config_path_)) {
425 LOG(ERROR) << "Can't find host config at " << host_config_path_.value(); 434 LOG(ERROR) << "Can't find host config at " << host_config_path_.value();
426 return false; 435 return false;
427 } 436 }
437
428 #endif // !defined(REMOTING_MULTI_PROCESS) 438 #endif // !defined(REMOTING_MULTI_PROCESS)
429 439
430 // Ignore certificate requests - the host currently has no client certificate 440 // Ignore certificate requests - the host currently has no client certificate
431 // support, so ignoring certificate requests allows connecting to servers that 441 // support, so ignoring certificate requests allows connecting to servers that
432 // request, but don't require, a certificate (optional client authentication). 442 // request, but don't require, a certificate (optional client authentication).
433 net::URLFetcher::SetIgnoreCertificateRequests(true); 443 net::URLFetcher::SetIgnoreCertificateRequests(true);
434 444
435 ServiceUrls* service_urls = ServiceUrls::GetInstance(); 445 ServiceUrls* service_urls = ServiceUrls::GetInstance();
436 bool xmpp_server_valid = net::ParseHostAndPort( 446 bool xmpp_server_valid = net::ParseHostAndPort(
437 service_urls->xmpp_server_address(), 447 service_urls->xmpp_server_address(),
438 &xmpp_server_config_.host, &xmpp_server_config_.port); 448 &xmpp_server_config_.host, &xmpp_server_config_.port);
439 if (!xmpp_server_valid) { 449 if (!xmpp_server_valid) {
440 LOG(ERROR) << "Invalid XMPP server: " << 450 LOG(ERROR) << "Invalid XMPP server: " <<
441 service_urls->xmpp_server_address(); 451 service_urls->xmpp_server_address();
442 return false; 452 return false;
443 } 453 }
444 xmpp_server_config_.use_tls = service_urls->xmpp_server_use_tls(); 454 xmpp_server_config_.use_tls = service_urls->xmpp_server_use_tls();
445 directory_bot_jid_ = service_urls->directory_bot_jid(); 455 directory_bot_jid_ = service_urls->directory_bot_jid();
446 456
447 signal_parent_ = cmd_line->HasSwitch(kSignalParentSwitchName); 457 signal_parent_ = cmd_line->HasSwitch(kSignalParentSwitchName);
448 458 enable_window_capture_ = cmd_line->HasSwitch(kWindowIdSwitchName);
459 if (enable_window_capture_) {
460 // CGWindowId is a uint_32t, so unsigned should be enough to
461 // hold the values.
462 unsigned temp;
Lambros 2014/07/30 00:14:49 nit: window_id is a better variable name.
ronakvora do not use 2014/07/30 20:55:37 Done.
463 if (base::StringToUint(cmd_line->GetSwitchValueASCII(
464 kWindowIdSwitchName), &temp)) {
465 // windowId_ is of type long int, so we should not lose
466 // any precision here.
Lambros 2014/07/30 00:14:49 You could verify this with an assertion. Use COMPI
ronakvora do not use 2014/07/30 20:55:37 What exactly would I want to check? That window_id
467 windowId_ = (webrtc::WindowId) temp;
Lambros 2014/07/30 00:14:49 nit: static_cast<webrtc::WindowId>(temp)
ronakvora do not use 2014/07/30 20:55:36 Done.
468 } else {
469 enable_window_capture_ = false;
470 }
471 }
449 return true; 472 return true;
450 } 473 }
451 474
452 void HostProcess::OnConfigUpdated( 475 void HostProcess::OnConfigUpdated(
453 const std::string& serialized_config) { 476 const std::string& serialized_config) {
454 if (!context_->network_task_runner()->BelongsToCurrentThread()) { 477 if (!context_->network_task_runner()->BelongsToCurrentThread()) {
455 context_->network_task_runner()->PostTask(FROM_HERE, 478 context_->network_task_runner()->PostTask(FROM_HERE,
456 base::Bind(&HostProcess::OnConfigUpdated, this, serialized_config)); 479 base::Bind(&HostProcess::OnConfigUpdated, this, serialized_config));
457 return; 480 return;
458 } 481 }
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 #if defined(OS_WIN) 692 #if defined(OS_WIN)
670 IpcDesktopEnvironmentFactory* desktop_environment_factory = 693 IpcDesktopEnvironmentFactory* desktop_environment_factory =
671 new IpcDesktopEnvironmentFactory( 694 new IpcDesktopEnvironmentFactory(
672 context_->audio_task_runner(), 695 context_->audio_task_runner(),
673 context_->network_task_runner(), 696 context_->network_task_runner(),
674 context_->video_capture_task_runner(), 697 context_->video_capture_task_runner(),
675 context_->network_task_runner(), 698 context_->network_task_runner(),
676 daemon_channel_.get()); 699 daemon_channel_.get());
677 desktop_session_connector_ = desktop_environment_factory; 700 desktop_session_connector_ = desktop_environment_factory;
678 #else // !defined(OS_WIN) 701 #else // !defined(OS_WIN)
679 DesktopEnvironmentFactory* desktop_environment_factory = 702 DesktopEnvironmentFactory* desktop_environment_factory;
703 if (enable_window_capture_) {
704 desktop_environment_factory =
705 new Me2MeWindowDesktopEnvironmentFactory(
Lambros 2014/07/30 00:14:49 This is the reason I'd prefer not to have yet anot
ronakvora do not use 2014/07/30 20:55:37 I do suppose we could add window functionality to
706 context_->network_task_runner(),
707 context_->input_task_runner(),
708 context_->ui_task_runner(),
709 windowId_,
710 enable_window_capture_);
711 } else {
712 desktop_environment_factory =
680 new Me2MeDesktopEnvironmentFactory( 713 new Me2MeDesktopEnvironmentFactory(
681 context_->network_task_runner(), 714 context_->network_task_runner(),
682 context_->input_task_runner(), 715 context_->input_task_runner(),
683 context_->ui_task_runner()); 716 context_->ui_task_runner());
717 }
684 #endif // !defined(OS_WIN) 718 #endif // !defined(OS_WIN)
685 719
686 desktop_environment_factory_.reset(desktop_environment_factory); 720 desktop_environment_factory_.reset(desktop_environment_factory);
687 desktop_environment_factory_->SetEnableGnubbyAuth(enable_gnubby_auth_); 721 desktop_environment_factory_->SetEnableGnubbyAuth(enable_gnubby_auth_);
688 722
689 context_->network_task_runner()->PostTask( 723 context_->network_task_runner()->PostTask(
690 FROM_HERE, 724 FROM_HERE,
691 base::Bind(&HostProcess::StartOnNetworkThread, this)); 725 base::Bind(&HostProcess::StartOnNetworkThread, this));
692 } 726 }
693 727
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 return exit_code; 1409 return exit_code;
1376 } 1410 }
1377 1411
1378 } // namespace remoting 1412 } // namespace remoting
1379 1413
1380 #if !defined(OS_WIN) 1414 #if !defined(OS_WIN)
1381 int main(int argc, char** argv) { 1415 int main(int argc, char** argv) {
1382 return remoting::HostMain(argc, argv); 1416 return remoting::HostMain(argc, argv);
1383 } 1417 }
1384 #endif // !defined(OS_WIN) 1418 #endif // !defined(OS_WIN)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698