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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 #include "ui/base/ui_base_switches.h" | 15 #include "ui/base/ui_base_switches.h" |
16 | 16 |
17 #if defined(USE_AURA) && !defined(OS_WIN) | 17 #if defined(USE_AURA) && !defined(OS_WIN) |
18 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
19 #include "ui/compositor/compositor.h" | 19 #include "ui/compositor/compositor.h" |
20 #endif // defined(USE_AURA) && !defined(OS_WIN) | 20 #endif // defined(USE_AURA) && !defined(OS_WIN) |
21 | 21 |
22 #if defined(OS_MACOSX) | 22 #if defined(OS_MACOSX) && !defined(OS_IOS) |
23 #include "base/mac/mac_util.h" | 23 #include "base/mac/mac_util.h" |
24 #endif | 24 #endif |
25 | 25 |
26 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
27 #include "base/win/metro.h" | 27 #include "base/win/metro.h" |
28 #include <Windows.h> | 28 #include <Windows.h> |
29 #endif // defined(OS_WIN) | 29 #endif // defined(OS_WIN) |
30 | 30 |
31 namespace { | 31 namespace { |
32 | 32 |
(...skipping 30 matching lines...) Expand all Loading... |
63 const float kScaleFactorScales[] = {1.0f, 1.4f, 1.8f, 2.0f}; | 63 const float kScaleFactorScales[] = {1.0f, 1.4f, 1.8f, 2.0f}; |
64 COMPILE_ASSERT(ui::NUM_SCALE_FACTORS == arraysize(kScaleFactorScales), | 64 COMPILE_ASSERT(ui::NUM_SCALE_FACTORS == arraysize(kScaleFactorScales), |
65 kScaleFactorScales_incorrect_size); | 65 kScaleFactorScales_incorrect_size); |
66 const size_t kScaleFactorScalesLength = arraysize(kScaleFactorScales); | 66 const size_t kScaleFactorScalesLength = arraysize(kScaleFactorScales); |
67 | 67 |
68 std::vector<ui::ScaleFactor>& GetSupportedScaleFactorsInternal() { | 68 std::vector<ui::ScaleFactor>& GetSupportedScaleFactorsInternal() { |
69 static std::vector<ui::ScaleFactor>* supported_scale_factors = | 69 static std::vector<ui::ScaleFactor>* supported_scale_factors = |
70 new std::vector<ui::ScaleFactor>(); | 70 new std::vector<ui::ScaleFactor>(); |
71 if (supported_scale_factors->empty()) { | 71 if (supported_scale_factors->empty()) { |
72 supported_scale_factors->push_back(ui::SCALE_FACTOR_100P); | 72 supported_scale_factors->push_back(ui::SCALE_FACTOR_100P); |
73 #if defined(OS_MACOSX) && defined(ENABLE_HIDPI) | 73 #if defined(OS_MACOSX) && !defined(OS_IOS) && defined(ENABLE_HIDPI) |
74 if (base::mac::IsOSLionOrLater()) | 74 if (base::mac::IsOSLionOrLater()) |
75 supported_scale_factors->push_back(ui::SCALE_FACTOR_200P); | 75 supported_scale_factors->push_back(ui::SCALE_FACTOR_200P); |
76 #elif defined(OS_WIN) && defined(ENABLE_HIDPI) | 76 #elif defined(OS_WIN) && defined(ENABLE_HIDPI) |
77 if (base::win::IsMetroProcess() && base::win::IsTouchEnabled()) { | 77 if (base::win::IsMetroProcess() && base::win::IsTouchEnabled()) { |
78 supported_scale_factors->push_back(ui::SCALE_FACTOR_140P); | 78 supported_scale_factors->push_back(ui::SCALE_FACTOR_140P); |
79 supported_scale_factors->push_back(ui::SCALE_FACTOR_180P); | 79 supported_scale_factors->push_back(ui::SCALE_FACTOR_180P); |
80 } | 80 } |
81 #elif defined(USE_ASH) | 81 #elif defined(USE_ASH) |
82 supported_scale_factors->push_back(ui::SCALE_FACTOR_200P); | 82 supported_scale_factors->push_back(ui::SCALE_FACTOR_200P); |
83 #endif | 83 #endif |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return GetScaleFactorFromScale( | 154 return GetScaleFactorFromScale( |
155 root_window->compositor()->device_scale_factor()); | 155 root_window->compositor()->device_scale_factor()); |
156 #else | 156 #else |
157 NOTIMPLEMENTED(); | 157 NOTIMPLEMENTED(); |
158 return SCALE_FACTOR_NONE; | 158 return SCALE_FACTOR_NONE; |
159 #endif | 159 #endif |
160 } | 160 } |
161 #endif // !defined(OS_MACOSX) | 161 #endif // !defined(OS_MACOSX) |
162 | 162 |
163 } // namespace ui | 163 } // namespace ui |
OLD | NEW |