Chromium Code Reviews| Index: remoting/host/remoting_me2me_host.cc |
| diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc |
| index cde2684a86c5be003ad21b0f60d3165e091040a1..f2ddf0bc0f98250ac86e5f18fe6944de1458e732 100644 |
| --- a/remoting/host/remoting_me2me_host.cc |
| +++ b/remoting/host/remoting_me2me_host.cc |
| @@ -61,6 +61,7 @@ |
| #include "remoting/host/json_host_config.h" |
| #include "remoting/host/logging.h" |
| #include "remoting/host/me2me_desktop_environment.h" |
| +#include "remoting/host/me2me_window_desktop_environment.h" |
| #include "remoting/host/pairing_registry_delegate.h" |
| #include "remoting/host/policy_hack/policy_watcher.h" |
| #include "remoting/host/session_manager_factory.h" |
| @@ -127,6 +128,8 @@ const char kEnableVp9SwitchName[] = "enable-vp9"; |
| // from stdin. |
| const char kStdinConfigPath[] = "-"; |
| +extern const char kWindowIdSwitchName[] = "window-Id"; |
| + |
| } // namespace |
| namespace remoting { |
| @@ -302,6 +305,12 @@ class HostProcess |
| ThirdPartyAuthConfig third_party_auth_config_; |
| bool enable_gnubby_auth_; |
| + // Boolean to change flow, where ncessary, if we're |
| + // capturing a window instead of the entire desktop. |
| + bool enable_window_capture_; |
| + // Used to specify which window to stream, if enabled. |
| + webrtc::WindowId windowId_; |
|
Lambros
2014/07/30 00:14:49
nit: window_id_
ronakvora do not use
2014/07/30 20:55:36
Done.
|
| + |
| scoped_ptr<OAuthTokenGetter> oauth_token_getter_; |
| scoped_ptr<XmppSignalStrategy> signal_strategy_; |
| scoped_ptr<SignalingConnector> signaling_connector_; |
| @@ -425,6 +434,7 @@ bool HostProcess::InitWithCommandLine(const base::CommandLine* cmd_line) { |
| LOG(ERROR) << "Can't find host config at " << host_config_path_.value(); |
| return false; |
| } |
| + |
| #endif // !defined(REMOTING_MULTI_PROCESS) |
| // Ignore certificate requests - the host currently has no client certificate |
| @@ -445,7 +455,20 @@ bool HostProcess::InitWithCommandLine(const base::CommandLine* cmd_line) { |
| directory_bot_jid_ = service_urls->directory_bot_jid(); |
| signal_parent_ = cmd_line->HasSwitch(kSignalParentSwitchName); |
| - |
| + enable_window_capture_ = cmd_line->HasSwitch(kWindowIdSwitchName); |
| + if (enable_window_capture_) { |
| + // CGWindowId is a uint_32t, so unsigned should be enough to |
| + // hold the values. |
| + 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.
|
| + if (base::StringToUint(cmd_line->GetSwitchValueASCII( |
| + kWindowIdSwitchName), &temp)) { |
| + // windowId_ is of type long int, so we should not lose |
| + // 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
|
| + 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.
|
| + } else { |
| + enable_window_capture_ = false; |
| + } |
| + } |
| return true; |
| } |
| @@ -676,11 +699,22 @@ void HostProcess::StartOnUiThread() { |
| daemon_channel_.get()); |
| desktop_session_connector_ = desktop_environment_factory; |
| #else // !defined(OS_WIN) |
| - DesktopEnvironmentFactory* desktop_environment_factory = |
| + DesktopEnvironmentFactory* desktop_environment_factory; |
| + if (enable_window_capture_) { |
| + desktop_environment_factory = |
| + 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
|
| + context_->network_task_runner(), |
| + context_->input_task_runner(), |
| + context_->ui_task_runner(), |
| + windowId_, |
| + enable_window_capture_); |
| + } else { |
| + desktop_environment_factory = |
| new Me2MeDesktopEnvironmentFactory( |
| context_->network_task_runner(), |
| context_->input_task_runner(), |
| context_->ui_task_runner()); |
| + } |
| #endif // !defined(OS_WIN) |
| desktop_environment_factory_.reset(desktop_environment_factory); |