OLD | NEW |
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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/mac/mac_util.h" | 6 #include "base/mac/mac_util.h" |
| 7 #include "base/mac/sdk_forward_declarations.h" |
7 #import "chrome/browser/ui/cocoa/nsview_additions.h" | 8 #import "chrome/browser/ui/cocoa/nsview_additions.h" |
8 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
9 #include "ui/base/ui_base_switches.h" | 10 #include "ui/base/ui_base_switches.h" |
10 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" | 11 #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
11 | 12 |
12 #include "base/logging.h" | 13 #include "base/logging.h" |
13 | 14 |
14 #if !defined(MAC_OS_X_VERSION_10_7) || \ | |
15 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 | |
16 | |
17 @interface NSView (LionAPI) | |
18 - (NSSize)convertSizeFromBacking:(NSSize)size; | |
19 @end | |
20 | |
21 #endif // 10.7 | |
22 | |
23 // Replicate specific 10.9 SDK declarations for building with prior SDKs. | |
24 #if !defined(MAC_OS_X_VERSION_10_9) || \ | |
25 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9 | |
26 | |
27 @interface NSView (MavericksAPI) | |
28 // Flatten all child views that did not call setWantsLayer:YES into this | |
29 // view's CALayer. | |
30 - (void)setCanDrawSubviewsIntoLayer:(BOOL)flag; | |
31 @end | |
32 | |
33 #endif // MAC_OS_X_VERSION_10_9 | |
34 | |
35 @implementation NSView (ChromeAdditions) | 15 @implementation NSView (ChromeAdditions) |
36 | 16 |
37 - (CGFloat)cr_lineWidth { | 17 - (CGFloat)cr_lineWidth { |
38 // All shipping retina macs run at least 10.7. | 18 // All shipping retina macs run at least 10.7. |
39 if (![self respondsToSelector:@selector(convertSizeFromBacking:)]) | 19 if (![self respondsToSelector:@selector(convertSizeFromBacking:)]) |
40 return 1; | 20 return 1; |
41 return [self convertSizeFromBacking:NSMakeSize(1, 1)].width; | 21 return [self convertSizeFromBacking:NSMakeSize(1, 1)].width; |
42 } | 22 } |
43 | 23 |
44 - (BOOL)cr_isMouseInView { | 24 - (BOOL)cr_isMouseInView { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 } | 109 } |
130 | 110 |
131 - (NSView*)cr_viewBeingDrawnTo { | 111 - (NSView*)cr_viewBeingDrawnTo { |
132 if (!g_ancestorBeingDrawnFrom) | 112 if (!g_ancestorBeingDrawnFrom) |
133 return self; | 113 return self; |
134 DCHECK(g_ancestorBeingDrawnFrom == self); | 114 DCHECK(g_ancestorBeingDrawnFrom == self); |
135 return g_childBeingDrawnTo; | 115 return g_childBeingDrawnTo; |
136 } | 116 } |
137 | 117 |
138 @end | 118 @end |
OLD | NEW |