| 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 delete g_supported_scale_factors; | 115 delete g_supported_scale_factors; |
| 116 g_supported_scale_factors = NULL; | 116 g_supported_scale_factors = NULL; |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 } // namespace test | 120 } // namespace test |
| 121 | 121 |
| 122 #if !defined(OS_MACOSX) | 122 #if !defined(OS_MACOSX) |
| 123 float GetScaleFactorForNativeView(gfx::NativeView view) { | 123 float GetScaleFactorForNativeView(gfx::NativeView view) { |
| 124 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); | 124 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); |
| 125 if (screen->IsDIPEnabled()) { | 125 gfx::Display display = screen->GetDisplayNearestWindow(view); |
| 126 gfx::Display display = screen->GetDisplayNearestWindow(view); | 126 return display.device_scale_factor(); |
| 127 return display.device_scale_factor(); | |
| 128 } | |
| 129 return 1.0f; | |
| 130 } | 127 } |
| 131 #endif // !defined(OS_MACOSX) | 128 #endif // !defined(OS_MACOSX) |
| 132 | 129 |
| 133 } // namespace ui | 130 } // namespace ui |
| OLD | NEW |