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

Unified Diff: remoting/host/client_session.cc

Issue 12678008: Reworked the plumbing required to pass the client resolution to the desktop resizer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback Created 7 years, 9 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/chromoting_messages.h ('k') | remoting/host/daemon_process.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/client_session.cc
diff --git a/remoting/host/client_session.cc b/remoting/host/client_session.cc
index e3cfaf7aa5b80e51606b33ce94e2e8d25807f282..1a6c973e8aa7cd928066f96f703611859b85d662 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) {
« no previous file with comments | « remoting/host/chromoting_messages.h ('k') | remoting/host/daemon_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698