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

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

Issue 12257016: (Not ready for review!) Toolbar and views high dpi support. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cleaned up more useless diffs. Created 7 years, 10 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
« no previous file with comments | « skia/ext/platform_device_win.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "ui/base/touch/touch_device.h" 15 #include "ui/base/touch/touch_device.h"
16 #include "ui/base/ui_base_switches.h" 16 #include "ui/base/ui_base_switches.h"
17 #include "ui/base/win/dpi.h"
17 #include "ui/gfx/display.h" 18 #include "ui/gfx/display.h"
18 #include "ui/gfx/screen.h" 19 #include "ui/gfx/screen.h"
19 20
20 #if defined(OS_MACOSX) && !defined(OS_IOS) 21 #if defined(OS_MACOSX) && !defined(OS_IOS)
21 #include "base/mac/mac_util.h" 22 #include "base/mac/mac_util.h"
22 #endif 23 #endif
23 24
24 #if defined(OS_WIN) 25 #if defined(OS_WIN)
25 #include "base/win/metro.h" 26 #include "base/win/metro.h"
26 #include <Windows.h> 27 #include <Windows.h>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 if (display.device_scale_factor() > 1.0) { 113 if (display.device_scale_factor() > 1.0) {
113 DCHECK_EQ(2.0, display.device_scale_factor()); 114 DCHECK_EQ(2.0, display.device_scale_factor());
114 supported_scale_factors->push_back(SCALE_FACTOR_200P); 115 supported_scale_factors->push_back(SCALE_FACTOR_200P);
115 } else { 116 } else {
116 supported_scale_factors->push_back(SCALE_FACTOR_100P); 117 supported_scale_factors->push_back(SCALE_FACTOR_100P);
117 } 118 }
118 #elif defined(OS_MACOSX) 119 #elif defined(OS_MACOSX)
119 if (base::mac::IsOSLionOrLater()) 120 if (base::mac::IsOSLionOrLater())
120 supported_scale_factors->push_back(SCALE_FACTOR_200P); 121 supported_scale_factors->push_back(SCALE_FACTOR_200P);
121 #elif defined(OS_WIN) && defined(ENABLE_HIDPI) 122 #elif defined(OS_WIN) && defined(ENABLE_HIDPI)
122 if (base::win::IsMetroProcess() && ui::IsTouchDevicePresent()) { 123 float scale = ui::GetDPIScale();
124 if (scale > 1.6)
125 supported_scale_factors->push_back(SCALE_FACTOR_180P);
126 else if (scale > 1.2)
123 supported_scale_factors->push_back(SCALE_FACTOR_140P); 127 supported_scale_factors->push_back(SCALE_FACTOR_140P);
124 supported_scale_factors->push_back(SCALE_FACTOR_180P); 128 else
125 } 129 #elif defined(OS_WIN)
130 supported_scale_factors->push_back(SCALE_FACTOR_100P);
126 #elif defined(OS_CHROMEOS) 131 #elif defined(OS_CHROMEOS)
127 // TODO(oshima): Include 200P only if the device support 200P 132 // TODO(oshima): Include 200P only if the device support 200P
128 supported_scale_factors->push_back(SCALE_FACTOR_200P); 133 supported_scale_factors->push_back(SCALE_FACTOR_200P);
129 #endif 134 #endif
130 std::sort(supported_scale_factors->begin(), 135 std::sort(supported_scale_factors->begin(),
131 supported_scale_factors->end(), 136 supported_scale_factors->end(),
132 ScaleFactorComparator); 137 ScaleFactorComparator);
133 } 138 }
134 return *supported_scale_factors; 139 return *supported_scale_factors;
135 } 140 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); 218 gfx::Screen* screen = gfx::Screen::GetScreenFor(view);
214 if (screen->IsDIPEnabled()) { 219 if (screen->IsDIPEnabled()) {
215 gfx::Display display = screen->GetDisplayNearestWindow(view); 220 gfx::Display display = screen->GetDisplayNearestWindow(view);
216 return GetScaleFactorFromScale(display.device_scale_factor()); 221 return GetScaleFactorFromScale(display.device_scale_factor());
217 } 222 }
218 return ui::SCALE_FACTOR_100P; 223 return ui::SCALE_FACTOR_100P;
219 } 224 }
220 #endif // !defined(OS_MACOSX) 225 #endif // !defined(OS_MACOSX)
221 226
222 } // namespace ui 227 } // namespace ui
OLDNEW
« no previous file with comments | « skia/ext/platform_device_win.cc ('k') | ui/base/resource/resource_bundle.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698