OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/base/scale.h" |
| 6 |
| 7 #include "base/basictypes.h" |
| 8 |
| 9 #if defined(OS_WIN) |
| 10 #include "ui/base/win/dpi.h" |
| 11 #include "ui/base/win/metro.h" |
| 12 #include <Windows.h> |
| 13 #endif // defined(OS_WIN) |
| 14 |
| 15 namespace { |
| 16 |
| 17 #if defined(OS_WIN) |
| 18 |
| 19 void GetScaleImplWin(bool* use_metro, bool* use_hidpi) { |
| 20 #if defined(ENABLE_METRO) |
| 21 *use_metro = ui::IsInMetroMode(); |
| 22 #endif // defined(ENABLE_METRO) |
| 23 #if defined(ENABLE_HIDPI) |
| 24 *use_hidpi = ui::GetDPIScale() > 1.5; |
| 25 #endif // defined(ENABLE_HIDPI) |
| 26 } |
| 27 |
| 28 #endif // defined(OS_WIN) |
| 29 |
| 30 } // namespace |
| 31 |
| 32 namespace ui { |
| 33 |
| 34 const DisplayScale GetDisplayScale() { |
| 35 #if defined(USE_ASH) |
| 36 return DS_ASH; |
| 37 #elif !defined(OS_WIN) |
| 38 return DS_DESKTOP_100; |
| 39 #else // On Windows. |
| 40 bool use_metro = false; |
| 41 bool use_hidpi = false; |
| 42 GetScaleImplWin(&use_metro, &use_hidpi); |
| 43 if (use_metro) { |
| 44 // TODO(joi): Other Metro scales. |
| 45 return DS_METRO_100; |
| 46 } else if (use_hidpi) { |
| 47 return DS_DESKTOP_200; |
| 48 } else { |
| 49 return DS_DESKTOP_100; |
| 50 } |
| 51 #endif // On Windows. |
| 52 } |
| 53 |
| 54 } // namespace ui |
OLD | NEW |