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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "remoting/host/desktop_resizer.h"
6
7 namespace remoting {
8
9 DesktopResizer::~DesktopResizer() {
10 }
11
12 DesktopResizer::HostStatusObserver::HostStatusObserver(
13 DesktopResizer* desktop_resizer)
14 : desktop_resizer_(desktop_resizer),
15 original_size_(SkISize::Make(0, 0)) {
16 }
17
18 void DesktopResizer::HostStatusObserver::OnClientAuthenticated(
19 const std::string& jid) {
20 original_size_ = desktop_resizer_->GetSize();
21 }
22
23 void DesktopResizer::HostStatusObserver::OnClientDisconnected(
24 const std::string& jid) {
25 SkISize zero = SkISize::Make(0, 0);
26 if (original_size_ != zero) {
27 desktop_resizer_->SetSize(original_size_);
28 original_size_ = zero;
29 }
30 }
31
32 void DesktopResizer::HostStatusObserver::OnClientDimensionsChanged(
33 const SkISize& size) {
34 // Set a sensible minimum size for the host desktop. Note that the
35 // implementation is free to impose a stricter minimum size and/or
36 // a maximum size in addition to this.
37 const int kMinWidth = 640;
38 const int kMinHeight = 480;
39 SkISize new_size(SkISize::Make(std::max(kMinWidth, size.width()),
40 std::max(kMinHeight, size.height())));
41 desktop_resizer_->SetSize(new_size);
42 }
43
44 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698