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/base/layout.h" | 5 #include "ui/base/layout.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } else if (switch_value != switches::kTouchOptimizedUIAuto) { | 59 } else if (switch_value != switches::kTouchOptimizedUIAuto) { |
60 LOG(ERROR) << "Invalid --touch-optimized-ui option: " << switch_value; | 60 LOG(ERROR) << "Invalid --touch-optimized-ui option: " << switch_value; |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 // We use the touch layout only when we are running in Metro mode. | 64 // We use the touch layout only when we are running in Metro mode. |
65 return base::win::IsMetroProcess() && ui::IsTouchDevicePresent(); | 65 return base::win::IsMetroProcess() && ui::IsTouchDevicePresent(); |
66 } | 66 } |
67 #endif // defined(OS_WIN) | 67 #endif // defined(OS_WIN) |
68 | 68 |
69 const float kScaleFactorScales[] = {1.0f, 1.0f, 1.33f, 1.4f, 1.5f, 1.8f, 2.0f}; | 69 const float kScaleFactorScales[] = {1.0f, 1.0f, 1.25f, 1.33f, 1.4f, 1.5f, 1.8f, |
| 70 2.0f}; |
70 COMPILE_ASSERT(NUM_SCALE_FACTORS == arraysize(kScaleFactorScales), | 71 COMPILE_ASSERT(NUM_SCALE_FACTORS == arraysize(kScaleFactorScales), |
71 kScaleFactorScales_incorrect_size); | 72 kScaleFactorScales_incorrect_size); |
72 const size_t kScaleFactorScalesLength = arraysize(kScaleFactorScales); | 73 const size_t kScaleFactorScalesLength = arraysize(kScaleFactorScales); |
73 | 74 |
74 namespace { | 75 namespace { |
75 | 76 |
76 // Returns the scale factor closest to |scale| from the full list of factors. | 77 // Returns the scale factor closest to |scale| from the full list of factors. |
77 // Note that it does NOT rely on the list of supported scale factors. | 78 // Note that it does NOT rely on the list of supported scale factors. |
78 // Finding the closest match is inefficient and shouldn't be done frequently. | 79 // Finding the closest match is inefficient and shouldn't be done frequently. |
79 ScaleFactor FindClosestScaleFactorUnsafe(float scale) { | 80 ScaleFactor FindClosestScaleFactorUnsafe(float scale) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); | 218 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); |
218 if (screen->IsDIPEnabled()) { | 219 if (screen->IsDIPEnabled()) { |
219 gfx::Display display = screen->GetDisplayNearestWindow(view); | 220 gfx::Display display = screen->GetDisplayNearestWindow(view); |
220 return GetScaleFactorFromScale(display.device_scale_factor()); | 221 return GetScaleFactorFromScale(display.device_scale_factor()); |
221 } | 222 } |
222 return ui::SCALE_FACTOR_100P; | 223 return ui::SCALE_FACTOR_100P; |
223 } | 224 } |
224 #endif // !defined(OS_MACOSX) | 225 #endif // !defined(OS_MACOSX) |
225 | 226 |
226 } // namespace ui | 227 } // namespace ui |
OLD | NEW |