Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1133)

Side by Side Diff: ui/base/scale.cc

Issue 10115029: Set toolbar padding to something appropriate for Metro icons. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove #ifdef from header. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« ui/base/scale.h ('K') | « ui/base/scale.h ('k') | ui/ui.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« ui/base/scale.h ('K') | « ui/base/scale.h ('k') | ui/ui.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698