OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |