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

Unified 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: Just a few nits. 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..59caf0b8b315c138aa8313dc3649e1aa31921242 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -65,6 +65,7 @@
#include "remoting/host/policy_hack/policy_watcher.h"
#include "remoting/host/session_manager_factory.h"
#include "remoting/host/signaling_connector.h"
+#include "remoting/host/single_window_desktop_environment.h"
#include "remoting/host/token_validator_factory_impl.h"
#include "remoting/host/usage_stats_consent.h"
#include "remoting/host/username.h"
@@ -127,6 +128,8 @@ const char kEnableVp9SwitchName[] = "enable-vp9";
// from stdin.
const char kStdinConfigPath[] = "-";
+const char kWindowIdSwitchName[] = "window-id";
+
} // namespace
namespace remoting {
@@ -302,6 +305,13 @@ 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_;
@@ -446,6 +456,24 @@ bool HostProcess::InitWithCommandLine(const base::CommandLine* cmd_line) {
signal_parent_ = cmd_line->HasSwitch(kSignalParentSwitchName);
+ enable_window_capture_ = cmd_line->HasSwitch(kWindowIdSwitchName);
+ if (enable_window_capture_) {
+ // uint32_t is large enough to hold window IDs on all platforms.
+ uint32_t window_id;
+ if (base::StringToUint(
+ cmd_line->GetSwitchValueASCII(kWindowIdSwitchName),
+ &window_id)) {
+ window_id_ = static_cast<webrtc::WindowId>(window_id);
+ } else {
+ // Set enable_window_capture_ to false because the window id from the
+ // command line was not found. Continue streaming the entire desktop
+ // instead.
Wez 2014/08/08 22:12:13 This comment is out of date.
ronakvora do not use 2014/08/08 22:28:26 Done.
+ LOG(ERROR) << "Window with window id: " << window_id_
+ << " not found. Shutting down host.";
+ enable_window_capture_ = false;
Wez 2014/08/08 22:12:14 No need to set this flag in this case, since you'r
ronakvora do not use 2014/08/08 22:28:26 Isn't the meaningful exit code to return false?
Wez 2014/08/11 06:40:36 That's the function return code - what will the pr
Sergey Ulanov 2014/08/12 18:18:00 Host should exit with kUsageExitCode after returni
ronakvora do not use 2014/08/13 18:04:43 Got it. removed.
+ return false;
+ }
+ }
return true;
}
@@ -676,11 +704,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 SingleWindowDesktopEnvironmentFactory(
+ 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);
« 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