summaryrefslogtreecommitdiffstats
path: root/remoting/host/client_session.cc
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-18 01:03:48 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-18 01:03:48 +0000
commit739e2803109683fec6e24ecbca3ad16fde7b43c4 (patch)
treed9459f07d896e6095e91f0590c420ea36495cecc /remoting/host/client_session.cc
parent9e359452151c9bbeaff2fee78a8fde678a42749b (diff)
downloadchromium_src-739e2803109683fec6e24ecbca3ad16fde7b43c4.zip
chromium_src-739e2803109683fec6e24ecbca3ad16fde7b43c4.tar.gz
chromium_src-739e2803109683fec6e24ecbca3ad16fde7b43c4.tar.bz2
Reworked the plumbing required to pass the client resolution to the desktop resizer.
This is mostly a renaming CL: - DesktopSessionParams -> ScreenResolution - OnClientResolutionChanged() -> SetScreenResolution(). Also added validation of ScreenResolution before passing it to session controllers. BUG=196316 Review URL: https://codereview.chromium.org/12678008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@188661 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/client_session.cc')
-rw-r--r--remoting/host/client_session.cc34
1 files changed, 20 insertions, 14 deletions
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index e3cfaf7..1a6c973 100644
--- a/remoting/host/client_session.cc
+++ b/remoting/host/client_session.cc
@@ -19,6 +19,7 @@
#include "remoting/host/audio_scheduler.h"
#include "remoting/host/desktop_environment.h"
#include "remoting/host/event_executor.h"
+#include "remoting/host/screen_resolution.h"
#include "remoting/host/session_controller.h"
#include "remoting/host/video_scheduler.h"
#include "remoting/proto/control.pb.h"
@@ -26,12 +27,10 @@
#include "remoting/protocol/client_stub.h"
#include "remoting/protocol/clipboard_thread_proxy.h"
-namespace remoting {
-
-namespace {
// Default DPI to assume for old clients that use notifyClientDimensions.
const int kDefaultDPI = 96;
-} // namespace
+
+namespace remoting {
ClientSession::ClientSession(
EventHandler* event_handler,
@@ -96,16 +95,23 @@ ClientSession::~ClientSession() {
void ClientSession::NotifyClientResolution(
const protocol::ClientResolution& resolution) {
- if (resolution.has_dips_width() && resolution.has_dips_height()) {
- VLOG(1) << "Received ClientResolution (dips_width="
- << resolution.dips_width() << ", dips_height="
- << resolution.dips_height() << ")";
- if (session_controller_) {
- session_controller_->OnClientResolutionChanged(
- SkIPoint::Make(kDefaultDPI, kDefaultDPI),
- SkISize::Make(resolution.dips_width(), resolution.dips_height()));
- }
- }
+ if (!resolution.has_dips_width() || !resolution.has_dips_height())
+ return;
+
+ VLOG(1) << "Received ClientResolution (dips_width="
+ << resolution.dips_width() << ", dips_height="
+ << resolution.dips_height() << ")";
+
+ if (!session_controller_)
+ return;
+
+ ScreenResolution client_resolution(
+ SkISize::Make(resolution.dips_width(), resolution.dips_height()),
+ SkIPoint::Make(kDefaultDPI, kDefaultDPI));
+
+ // Try to match the client's resolution.
+ if (client_resolution.IsValid())
+ session_controller_->SetScreenResolution(client_resolution);
}
void ClientSession::ControlVideo(const protocol::VideoControl& video_control) {