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

Side by Side Diff: remoting/host/resizing_host_observer.cc

Issue 1547473005: Switch to standard integer types in remoting/host/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/host/resizing_host_observer.h" 5 #include "remoting/host/resizing_host_observer.h"
6 6
7 #include <stdint.h>
8
7 #include <list> 9 #include <list>
8 10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
12 #include "remoting/host/desktop_resizer.h" 14 #include "remoting/host/desktop_resizer.h"
13 #include "remoting/host/screen_resolution.h" 15 #include "remoting/host/screen_resolution.h"
14 16
15 namespace remoting { 17 namespace remoting {
16 namespace { 18 namespace {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 if (candidate_aspect_ratio > preferred_aspect_ratio) { 62 if (candidate_aspect_ratio > preferred_aspect_ratio) {
61 aspect_ratio_goodness_ = preferred_aspect_ratio / candidate_aspect_ratio; 63 aspect_ratio_goodness_ = preferred_aspect_ratio / candidate_aspect_ratio;
62 } else { 64 } else {
63 aspect_ratio_goodness_ = candidate_aspect_ratio / preferred_aspect_ratio; 65 aspect_ratio_goodness_ = candidate_aspect_ratio / preferred_aspect_ratio;
64 } 66 }
65 } 67 }
66 68
67 const ScreenResolution& resolution() const { return resolution_; } 69 const ScreenResolution& resolution() const { return resolution_; }
68 float client_scale_factor() const { return client_scale_factor_; } 70 float client_scale_factor() const { return client_scale_factor_; }
69 float aspect_ratio_goodness() const { return aspect_ratio_goodness_; } 71 float aspect_ratio_goodness() const { return aspect_ratio_goodness_; }
70 int64 area() const { 72 int64_t area() const {
71 return static_cast<int64>(resolution_.dimensions().width()) * 73 return static_cast<int64_t>(resolution_.dimensions().width()) *
72 resolution_.dimensions().height(); 74 resolution_.dimensions().height();
73 } 75 }
74 76
75 // TODO(jamiewalch): Also compare the DPI: http://crbug.com/172405 77 // TODO(jamiewalch): Also compare the DPI: http://crbug.com/172405
76 bool IsBetterThan(const CandidateResolution& other) const { 78 bool IsBetterThan(const CandidateResolution& other) const {
77 // If either resolution would require down-scaling, prefer the one that 79 // If either resolution would require down-scaling, prefer the one that
78 // down-scales the least (since the client scale factor is at most 1.0, 80 // down-scales the least (since the client scale factor is at most 1.0,
79 // this does not differentiate between resolutions that don't require 81 // this does not differentiate between resolutions that don't require
80 // down-scaling). 82 // down-scaling).
81 if (client_scale_factor() < other.client_scale_factor()) { 83 if (client_scale_factor() < other.client_scale_factor()) {
82 return false; 84 return false;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // Update the time of last resize to allow it to be rate-limited. 179 // Update the time of last resize to allow it to be rate-limited.
178 previous_resize_time_ = now; 180 previous_resize_time_ = now;
179 } 181 }
180 182
181 void ResizingHostObserver::SetNowFunctionForTesting( 183 void ResizingHostObserver::SetNowFunctionForTesting(
182 const base::Callback<base::Time(void)>& now_function) { 184 const base::Callback<base::Time(void)>& now_function) {
183 now_function_ = now_function; 185 now_function_ = now_function;
184 } 186 }
185 187
186 } // namespace remoting 188 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/resizing_host_observer.h ('k') | remoting/host/resizing_host_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698