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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 const std::vector<ui::ScaleFactor>& scale_factors) { | 144 const std::vector<ui::ScaleFactor>& scale_factors) { |
145 std::vector<ui::ScaleFactor>& supported_scale_factors = | 145 std::vector<ui::ScaleFactor>& supported_scale_factors = |
146 GetSupportedScaleFactorsInternal(); | 146 GetSupportedScaleFactorsInternal(); |
147 supported_scale_factors = scale_factors; | 147 supported_scale_factors = scale_factors; |
148 } | 148 } |
149 | 149 |
150 } // namespace test | 150 } // namespace test |
151 | 151 |
152 #if !defined(OS_MACOSX) | 152 #if !defined(OS_MACOSX) |
153 ScaleFactor GetScaleFactorForNativeView(gfx::NativeView view) { | 153 ScaleFactor GetScaleFactorForNativeView(gfx::NativeView view) { |
154 if (gfx::Screen::IsDIPEnabled()) { | 154 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); |
155 gfx::Display display = gfx::Screen::GetDisplayNearestWindow(view); | 155 if (screen->IsDIPEnabled()) { |
| 156 gfx::Display display = screen->GetDisplayNearestWindow(view); |
156 return GetScaleFactorFromScale(display.device_scale_factor()); | 157 return GetScaleFactorFromScale(display.device_scale_factor()); |
157 } | 158 } |
158 return ui::SCALE_FACTOR_100P; | 159 return ui::SCALE_FACTOR_100P; |
159 } | 160 } |
160 #endif // !defined(OS_MACOSX) | 161 #endif // !defined(OS_MACOSX) |
161 | 162 |
162 } // namespace ui | 163 } // namespace ui |
OLD | NEW |