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

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

Issue 1278173006: Default to 1 when --force-device-scale-factor has an invalid value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: with unit test Created 5 years, 4 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
« no previous file with comments | « base/strings/string_number_conversions.h ('k') | ui/gfx/display_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/gfx/display.h" 5 #include "ui/gfx/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 22 matching lines...) Expand all
33 return base::CommandLine::ForCurrentProcess()->HasSwitch( 33 return base::CommandLine::ForCurrentProcess()->HasSwitch(
34 switches::kForceDeviceScaleFactor); 34 switches::kForceDeviceScaleFactor);
35 } 35 }
36 36
37 float GetForcedDeviceScaleFactorImpl() { 37 float GetForcedDeviceScaleFactorImpl() {
38 double scale_in_double = 1.0; 38 double scale_in_double = 1.0;
39 if (HasForceDeviceScaleFactorImpl()) { 39 if (HasForceDeviceScaleFactorImpl()) {
40 std::string value = 40 std::string value =
41 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 41 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
42 switches::kForceDeviceScaleFactor); 42 switches::kForceDeviceScaleFactor);
43 if (!base::StringToDouble(value, &scale_in_double)) 43 if (!base::StringToDouble(value, &scale_in_double)) {
44 LOG(ERROR) << "Failed to parse the default device scale factor:" << value; 44 LOG(ERROR) << "Failed to parse the default device scale factor:" << value;
45 scale_in_double = 1.0;
46 }
45 } 47 }
46 return static_cast<float>(scale_in_double); 48 return static_cast<float>(scale_in_double);
47 } 49 }
48 50
49 int64 internal_display_id_ = -1; 51 int64 internal_display_id_ = -1;
50 52
51 } // namespace 53 } // namespace
52 54
53 const int64 Display::kInvalidDisplayID = -1; 55 const int64 Display::kInvalidDisplayID = -1;
54 56
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 DCHECK_NE(kInvalidDisplayID, display_id); 216 DCHECK_NE(kInvalidDisplayID, display_id);
215 return HasInternalDisplay() && internal_display_id_ == display_id; 217 return HasInternalDisplay() && internal_display_id_ == display_id;
216 } 218 }
217 219
218 // static 220 // static
219 bool Display::HasInternalDisplay() { 221 bool Display::HasInternalDisplay() {
220 return internal_display_id_ != kInvalidDisplayID; 222 return internal_display_id_ != kInvalidDisplayID;
221 } 223 }
222 224
223 } // namespace gfx 225 } // namespace gfx
OLDNEW
« no previous file with comments | « base/strings/string_number_conversions.h ('k') | ui/gfx/display_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698