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

Unified Diff: remoting/host/desktop_resizer.cc

Issue 10918224: Cross-platform plumbing for resize-to-client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Clang errors. Created 8 years, 3 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_resizer.cc
diff --git a/remoting/host/desktop_resizer.cc b/remoting/host/desktop_resizer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..16ad67b50c16bfb50d864b096b0df10f70c191c0
--- /dev/null
+++ b/remoting/host/desktop_resizer.cc
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/desktop_resizer.h"
+
+namespace remoting {
+
+DesktopResizer::~DesktopResizer() {
+}
+
+DesktopResizer::HostStatusObserver::HostStatusObserver(
+ DesktopResizer* desktop_resizer)
+ : desktop_resizer_(desktop_resizer),
+ original_size_(SkISize::Make(0, 0)) {
+}
+
+DesktopResizer::HostStatusObserver::~HostStatusObserver() {
+}
+
+void DesktopResizer::HostStatusObserver::OnClientAuthenticated(
+ const std::string& jid) {
+ original_size_ = desktop_resizer_->GetSize();
+}
+
+void DesktopResizer::HostStatusObserver::OnClientDisconnected(
+ const std::string& jid) {
+ if (!original_size_.isZero()) {
+ desktop_resizer_->SetSize(original_size_);
+ original_size_.set(0, 0);
+ }
+}
+
+void DesktopResizer::HostStatusObserver::OnClientDimensionsChanged(
+ const SkISize& size) {
+ // Set a sensible minimum size for the host desktop. Note that the
+ // implementation is free to impose a stricter minimum size and/or
+ // a maximum size in addition to this.
+ const int kMinWidth = 640;
+ const int kMinHeight = 480;
+ SkISize new_size(SkISize::Make(std::max(kMinWidth, size.width()),
+ std::max(kMinHeight, size.height())));
+ desktop_resizer_->SetSize(new_size);
+}
+
+} // namespace remoting

Powered by Google App Engine
This is Rietveld 408576698