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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 | 66 |
67 const float kScaleFactorScales[] = {1.0f, 1.4f, 1.8f, 2.0f}; | 67 const float kScaleFactorScales[] = {1.0f, 1.4f, 1.8f, 2.0f}; |
68 COMPILE_ASSERT(NUM_SCALE_FACTORS == arraysize(kScaleFactorScales), | 68 COMPILE_ASSERT(NUM_SCALE_FACTORS == arraysize(kScaleFactorScales), |
69 kScaleFactorScales_incorrect_size); | 69 kScaleFactorScales_incorrect_size); |
70 const size_t kScaleFactorScalesLength = arraysize(kScaleFactorScales); | 70 const size_t kScaleFactorScalesLength = arraysize(kScaleFactorScales); |
71 | 71 |
72 std::vector<ScaleFactor>& GetSupportedScaleFactorsInternal() { | 72 std::vector<ScaleFactor>& GetSupportedScaleFactorsInternal() { |
73 static std::vector<ScaleFactor>* supported_scale_factors = | 73 static std::vector<ScaleFactor>* supported_scale_factors = |
74 new std::vector<ScaleFactor>(); | 74 new std::vector<ScaleFactor>(); |
75 if (supported_scale_factors->empty()) { | 75 if (supported_scale_factors->empty()) { |
76 #if !defined(OS_IOS) | 76 // 100P is always a supported scale factor. |
77 // On platforms other than iOS, 100P is always a supported scale factor. | |
78 supported_scale_factors->push_back(SCALE_FACTOR_100P); | 77 supported_scale_factors->push_back(SCALE_FACTOR_100P); |
79 #endif | |
80 | 78 |
81 #if defined(OS_IOS) | 79 #if defined(OS_IOS) |
| 80 // TODO(ios): 100p should not be necessary on iOS retina devices. However |
| 81 // the sync service only supports syncing 100p favicons. Until sync supports |
| 82 // other scales 100p is needed in the list of scale factors to retrieve and |
| 83 // store the favicons in both 100p for sync and 200p for display. cr/160503. |
82 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 84 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
83 if (display.device_scale_factor() > 1.0) { | 85 if (display.device_scale_factor() > 1.0) { |
84 DCHECK_EQ(2.0, display.device_scale_factor()); | 86 DCHECK_EQ(2.0, display.device_scale_factor()); |
85 supported_scale_factors->push_back(SCALE_FACTOR_200P); | 87 supported_scale_factors->push_back(SCALE_FACTOR_200P); |
86 } else { | |
87 supported_scale_factors->push_back(SCALE_FACTOR_100P); | |
88 } | 88 } |
89 #elif defined(OS_MACOSX) | 89 #elif defined(OS_MACOSX) |
90 if (base::mac::IsOSLionOrLater()) | 90 if (base::mac::IsOSLionOrLater()) |
91 supported_scale_factors->push_back(SCALE_FACTOR_200P); | 91 supported_scale_factors->push_back(SCALE_FACTOR_200P); |
92 #elif defined(OS_WIN) && defined(ENABLE_HIDPI) | 92 #elif defined(OS_WIN) && defined(ENABLE_HIDPI) |
93 if (base::win::IsMetroProcess() && base::win::IsTouchEnabled()) { | 93 if (base::win::IsMetroProcess() && base::win::IsTouchEnabled()) { |
94 supported_scale_factors->push_back(SCALE_FACTOR_140P); | 94 supported_scale_factors->push_back(SCALE_FACTOR_140P); |
95 supported_scale_factors->push_back(SCALE_FACTOR_180P); | 95 supported_scale_factors->push_back(SCALE_FACTOR_180P); |
96 } | 96 } |
97 #elif defined(USE_ASH) | 97 #elif defined(USE_ASH) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); | 179 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); |
180 if (screen->IsDIPEnabled()) { | 180 if (screen->IsDIPEnabled()) { |
181 gfx::Display display = screen->GetDisplayNearestWindow(view); | 181 gfx::Display display = screen->GetDisplayNearestWindow(view); |
182 return GetScaleFactorFromScale(display.device_scale_factor()); | 182 return GetScaleFactorFromScale(display.device_scale_factor()); |
183 } | 183 } |
184 return ui::SCALE_FACTOR_100P; | 184 return ui::SCALE_FACTOR_100P; |
185 } | 185 } |
186 #endif // !defined(OS_MACOSX) | 186 #endif // !defined(OS_MACOSX) |
187 | 187 |
188 } // namespace ui | 188 } // namespace ui |
OLD | NEW |