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

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: Better positioning for new tab button. Simplify scale.h interface. 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
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
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