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

Side by Side Diff: ui/display/display.cc

Issue 2855143004: Implements a display scale tray setting behind a chrome switch (Closed)
Patch Set: nit Created 3 years, 7 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 "ui/display/display.h" 5 #include "ui/display/display.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 g_has_forced_device_scale_factor = HasForceDeviceScaleFactorImpl(); 83 g_has_forced_device_scale_factor = HasForceDeviceScaleFactorImpl();
84 return !!g_has_forced_device_scale_factor; 84 return !!g_has_forced_device_scale_factor;
85 } 85 }
86 86
87 // static 87 // static
88 void Display::ResetForceDeviceScaleFactorForTesting() { 88 void Display::ResetForceDeviceScaleFactorForTesting() {
89 g_has_forced_device_scale_factor = -1; 89 g_has_forced_device_scale_factor = -1;
90 g_forced_device_scale_factor = -1.0; 90 g_forced_device_scale_factor = -1.0;
91 } 91 }
92 92
93 // static
94 void Display::SetForceDeviceScaleFactor(double dsf) {
95 // Reset any previously set values and unset the flag.
96 g_has_forced_device_scale_factor = -1;
97 g_forced_device_scale_factor = -1.0;
oshima 2017/05/09 03:58:21 I somehow missed this change in the first review.
malaykeshav 2017/05/10 05:28:27 It should work. I just read the comment for `g_has
98
99 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
100 switches::kForceDeviceScaleFactor, base::StringPrintf("%.2f", dsf));
101 }
102
93 Display::Display() : Display(kInvalidDisplayId) {} 103 Display::Display() : Display(kInvalidDisplayId) {}
94 104
95 Display::Display(int64_t id) : Display(id, gfx::Rect()) {} 105 Display::Display(int64_t id) : Display(id, gfx::Rect()) {}
96 106
97 Display::Display(int64_t id, const gfx::Rect& bounds) 107 Display::Display(int64_t id, const gfx::Rect& bounds)
98 : id_(id), 108 : id_(id),
99 bounds_(bounds), 109 bounds_(bounds),
100 work_area_(bounds), 110 work_area_(bounds),
101 device_scale_factor_(GetForcedDeviceScaleFactor()), 111 device_scale_factor_(GetForcedDeviceScaleFactor()),
102 color_depth_(DEFAULT_BITS_PER_PIXEL), 112 color_depth_(DEFAULT_BITS_PER_PIXEL),
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 DCHECK_NE(kInvalidDisplayId, display_id); 235 DCHECK_NE(kInvalidDisplayId, display_id);
226 return HasInternalDisplay() && internal_display_id_ == display_id; 236 return HasInternalDisplay() && internal_display_id_ == display_id;
227 } 237 }
228 238
229 // static 239 // static
230 bool Display::HasInternalDisplay() { 240 bool Display::HasInternalDisplay() {
231 return internal_display_id_ != kInvalidDisplayId; 241 return internal_display_id_ != kInvalidDisplayId;
232 } 242 }
233 243
234 } // namespace display 244 } // namespace display
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698