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

Side by Side Diff: ui/base/layout_mac.mm

Issue 1777653002: Prepare ui/ module for compilation with OS X 10.7 deployment target. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More compile errors. Created 4 years, 9 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 | « ui/base/cocoa/command_dispatcher.mm ('k') | ui/base/test/ui_controls_mac.mm » ('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 <Cocoa/Cocoa.h> 7 #include <Cocoa/Cocoa.h>
8 8
9 #include "base/mac/sdk_forward_declarations.h" 9 #include "base/mac/sdk_forward_declarations.h"
10 10
11 namespace { 11 namespace {
12 12
13 float GetScaleFactorScaleForNativeView(gfx::NativeView view) { 13 float GetScaleFactorScaleForNativeView(gfx::NativeView view) {
14 if (NSWindow* window = [view window]) { 14 if (NSWindow* window = [view window]) {
15 if ([window respondsToSelector:@selector(backingScaleFactor)]) 15 return [window backingScaleFactor];
16 return [window backingScaleFactor];
17 return [window userSpaceScaleFactor];
18 } 16 }
19 17
20 NSArray* screens = [NSScreen screens]; 18 NSArray* screens = [NSScreen screens];
21 if (![screens count]) 19 if (![screens count])
22 return 1.0f; 20 return 1.0f;
23 21
24 NSScreen* screen = [screens objectAtIndex:0]; 22 NSScreen* screen = [screens objectAtIndex:0];
25 if ([screen respondsToSelector:@selector(backingScaleFactor)]) 23 return [screen backingScaleFactor];
26 return [screen backingScaleFactor];
27 return [screen userSpaceScaleFactor];
28 } 24 }
29 25
30 } // namespace 26 } // namespace
31 27
32 namespace ui { 28 namespace ui {
33 29
34 float GetScaleFactorForNativeView(gfx::NativeView view) { 30 float GetScaleFactorForNativeView(gfx::NativeView view) {
35 return GetScaleFactorScaleForNativeView(view); 31 return GetScaleFactorScaleForNativeView(view);
36 } 32 }
37 33
38 } // namespace ui 34 } // namespace ui
OLDNEW
« no previous file with comments | « ui/base/cocoa/command_dispatcher.mm ('k') | ui/base/test/ui_controls_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698