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..31ed526d55242ae317d6c2a1b7b1d618adc39d5f 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 window_id_; |
+ |
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 window_id; |
Wez
2014/08/01 23:41:55
Unsigned what? Why not uint32_t?
ronakvora do not use
2014/08/05 19:54:50
Not sure. I was following an example from somewher
|
+ if (base::StringToUint(cmd_line->GetSwitchValueASCII( |
+ kWindowIdSwitchName), &window_id)) { |
Wez
2014/08/01 23:41:55
kWindowIdSwitchName should be indented by 4 spaces
ronakvora do not use
2014/08/05 19:54:50
Done. Wrapped after cmd_line.
|
+ // window_id_ is of type long int, so we should not lose |
+ // any precision here. |
+ window_id_ = static_cast<webrtc::WindowId>(window_id); |
+ } else { |
+ enable_window_capture_ = false; |
+ } |
+ } |
return true; |
} |
@@ -676,11 +699,21 @@ 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( |
+ context_->network_task_runner(), |
+ context_->input_task_runner(), |
+ context_->ui_task_runner(), |
+ window_id_); |
+ } 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); |