| 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.0f, 1.4f, 1.8f, 2.0f}; | 67 const float kScaleFactorScales[] = {1.0f, 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) |
| 82 // TODO(ios): 100p should not be necessary on iOS retina devices. However | 80 // TODO(ios): 100p should not be necessary on iOS retina devices. However |
| 83 // the sync service only supports syncing 100p favicons. Until sync supports | 81 // the sync service only supports syncing 100p favicons. Until sync supports |
| 84 // other scales 100p is needed in the list of scale factors to retrieve and | 82 // other scales 100p is needed in the list of scale factors to retrieve and |
| 85 // store the favicons in both 100p for sync and 200p for display. cr/160503. | 83 // store the favicons in both 100p for sync and 200p for display. cr/160503. |
| 86 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 84 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); |
| 87 if (display.device_scale_factor() > 1.0) { | 85 if (display.device_scale_factor() > 1.0) { |
| 88 DCHECK_EQ(2.0, display.device_scale_factor()); | 86 DCHECK_EQ(2.0, display.device_scale_factor()); |
| 89 supported_scale_factors->push_back(SCALE_FACTOR_200P); | 87 supported_scale_factors->push_back(SCALE_FACTOR_200P); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); | 181 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); |
| 184 if (screen->IsDIPEnabled()) { | 182 if (screen->IsDIPEnabled()) { |
| 185 gfx::Display display = screen->GetDisplayNearestWindow(view); | 183 gfx::Display display = screen->GetDisplayNearestWindow(view); |
| 186 return GetScaleFactorFromScale(display.device_scale_factor()); | 184 return GetScaleFactorFromScale(display.device_scale_factor()); |
| 187 } | 185 } |
| 188 return ui::SCALE_FACTOR_100P; | 186 return ui::SCALE_FACTOR_100P; |
| 189 } | 187 } |
| 190 #endif // !defined(OS_MACOSX) | 188 #endif // !defined(OS_MACOSX) |
| 191 | 189 |
| 192 } // namespace ui | 190 } // namespace ui |
| OLD | NEW |