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