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

Unified Diff: remoting/host/desktop_session_proxy.cc

Issue 13932020: Set the initial resolution of an RDP session to the client screen resolution if it is available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback #2 Created 7 years, 8 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
Index: remoting/host/desktop_session_proxy.cc
diff --git a/remoting/host/desktop_session_proxy.cc b/remoting/host/desktop_session_proxy.cc
index 04add543b748fba7e1da31d563d1047bf6a6d829..9e1bd5dd838a11b8447f3e8b82220eb38f1daff6 100644
--- a/remoting/host/desktop_session_proxy.cc
+++ b/remoting/host/desktop_session_proxy.cc
@@ -28,6 +28,8 @@
#include "base/win/scoped_handle.h"
#endif // defined(OS_WIN)
+const char kSendInitialResolution[] = "sendInitialResolution";
+
namespace remoting {
DesktopSessionProxy::DesktopSessionProxy(
@@ -35,14 +37,19 @@ DesktopSessionProxy::DesktopSessionProxy(
scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner,
- base::WeakPtr<ClientSessionControl> client_session_control)
+ base::WeakPtr<ClientSessionControl> client_session_control,
+ base::WeakPtr<DesktopSessionConnector> desktop_session_connector,
+ bool virtual_terminal)
: audio_capture_task_runner_(audio_capture_task_runner),
caller_task_runner_(caller_task_runner),
io_task_runner_(io_task_runner),
video_capture_task_runner_(video_capture_task_runner),
client_session_control_(client_session_control),
+ desktop_session_connector_(desktop_session_connector),
desktop_process_(base::kNullProcessHandle),
- pending_capture_frame_requests_(0) {
+ pending_capture_frame_requests_(0),
+ is_desktop_session_created_(false),
+ virtual_terminal_(virtual_terminal) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
}
@@ -70,6 +77,33 @@ scoped_ptr<media::ScreenCapturer> DesktopSessionProxy::CreateVideoCapturer() {
return scoped_ptr<media::ScreenCapturer>(new IpcVideoFrameCapturer(this));
}
+Capabilities DesktopSessionProxy::GetCapabilities() const {
+ // Ask the client to send it's resolution unconditionally.
+ return virtual_terminal_ ? Capabilities(kSendInitialResolution) :
+ Capabilities();
+}
+
+void DesktopSessionProxy::SetCapabilities(const Capabilities& capabilities) {
+ // Delay creation of the desktop session until the client screen resolution is
+ // received if the desktop session requires the initial screen resolution
+ // (when |virtual_terminal_| is true) and the client is expected to
+ // sent its screen resolution (the 'sendInitialResolution' capability is
+ // supported).
+ if (virtual_terminal_ && capabilities.HasCapability(kSendInitialResolution)) {
+ VLOG(1) << "Waiting for the client screen resolution.";
+ return;
+ }
+
+ // Create the desktop session.
+ if (!is_desktop_session_created_) {
+ is_desktop_session_created_ = true;
Sergey Ulanov 2013/04/16 08:38:53 is_desktop_session_connected_?
alexeypa (please no reviews) 2013/04/16 22:06:11 Done.
+ if (desktop_session_connector_) {
+ desktop_session_connector_->ConnectTerminal(this, screen_resolution_,
+ virtual_terminal_);
+ }
+ }
+}
+
bool DesktopSessionProxy::OnMessageReceived(const IPC::Message& message) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
@@ -288,36 +322,35 @@ void DesktopSessionProxy::SetScreenResolution(
const ScreenResolution& resolution) {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
+ if (!resolution.IsValid())
+ return;
+
screen_resolution_ = resolution;
- if (!screen_resolution_.IsValid())
+
+ // Create the desktop session if it is not created yet.
+ if (!is_desktop_session_created_) {
+ is_desktop_session_created_ = true;
+ if (desktop_session_connector_) {
+ desktop_session_connector_->ConnectTerminal(this, screen_resolution_,
+ virtual_terminal_);
+ }
return;
+ }
// Pass the client's resolution to both daemon and desktop session agent.
- // Depending on the session kind the screen resolution ccan be set by either
+ // Depending on the session kind the screen resolution can be set by either
// the daemon (for example RDP sessions on Windows) or by the desktop session
// agent (when sharing the physical console).
if (desktop_session_connector_)
- desktop_session_connector_->SetScreenResolution(this, resolution);
+ desktop_session_connector_->SetScreenResolution(this, screen_resolution_);
SendToDesktop(
- new ChromotingNetworkDesktopMsg_SetScreenResolution(resolution));
-}
-
-void DesktopSessionProxy::ConnectToDesktopSession(
- base::WeakPtr<DesktopSessionConnector> desktop_session_connector,
- bool virtual_terminal) {
- DCHECK(caller_task_runner_->BelongsToCurrentThread());
- DCHECK(!desktop_session_connector_);
- DCHECK(desktop_session_connector);
-
- desktop_session_connector_ = desktop_session_connector;
- desktop_session_connector_->ConnectTerminal(
- this, ScreenResolution(), virtual_terminal);
+ new ChromotingNetworkDesktopMsg_SetScreenResolution(screen_resolution_));
}
DesktopSessionProxy::~DesktopSessionProxy() {
DCHECK(caller_task_runner_->BelongsToCurrentThread());
- if (desktop_session_connector_)
+ if (desktop_session_connector_ && is_desktop_session_created_)
desktop_session_connector_->DisconnectTerminal(this);
if (desktop_process_ != base::kNullProcessHandle) {

Powered by Google App Engine
This is Rietveld 408576698