|
37 | 37 |
|
38 | 38 | #ifdef BUILDING_CEF_SHARED |
39 | 39 |
|
40 | | -// Use the existing CrAppProtocol definition. |
41 | | -#import "base/message_pump_mac.h" |
42 | | - |
43 | 40 | // Use the existing CrAppControlProtocol definition. |
44 | 41 | #import "base/mac/scoped_sending_event.h" |
45 | 42 |
|
| 43 | +// Use the existing CrAppProtocol definition. |
| 44 | +#import "base/message_loop/message_pump_mac.h" |
| 45 | + |
46 | 46 | // Use the existing UnderlayableSurface definition. |
47 | 47 | #import "ui/base/cocoa/underlay_opengl_hosting_window.h" |
48 | 48 |
|
49 | 49 | // Use the existing empty protocol definitions. |
50 | 50 | #import "base/mac/cocoa_protocols.h" |
51 | 51 |
|
| 52 | +// Use the existing empty protocol definitions. |
| 53 | +#import "base/mac/sdk_forward_declarations.h" |
| 54 | + |
52 | 55 | #else // BUILDING_CEF_SHARED |
53 | 56 |
|
54 | 57 | #import <AppKit/AppKit.h> |
55 | 58 | #import <Cocoa/Cocoa.h> |
56 | 59 |
|
57 | | -// Copy of definition from base/message_pump_mac.h. |
| 60 | +// Copy of definition from base/message_loop/message_pump_mac.h. |
58 | 61 | @protocol CrAppProtocol |
59 | 62 | // Must return true if -[NSApplication sendEvent:] is currently on the stack. |
60 | 63 | - (BOOL)isHandlingSendEvent; |
|
72 | 75 | @interface UnderlayOpenGLHostingWindow : NSWindow |
73 | 76 | @end |
74 | 77 |
|
| 78 | +// Copy of definitions from base/mac/sdk_forward_declarations.h. |
| 79 | +// Forward declarations for APIs that are part of the 10.7 SDK. This will allow |
| 80 | +// using them when building with the 10.6 SDK. |
| 81 | + |
| 82 | +#if !defined(MAC_OS_X_VERSION_10_7) || \ |
| 83 | + MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
| 84 | + |
| 85 | +enum { |
| 86 | + NSEventPhaseNone = 0, // event not associated with a phase. |
| 87 | + NSEventPhaseBegan = 0x1 << 0, |
| 88 | + NSEventPhaseStationary = 0x1 << 1, |
| 89 | + NSEventPhaseChanged = 0x1 << 2, |
| 90 | + NSEventPhaseEnded = 0x1 << 3, |
| 91 | + NSEventPhaseCancelled = 0x1 << 4, |
| 92 | +}; |
| 93 | +typedef NSUInteger NSEventPhase; |
| 94 | + |
| 95 | +@interface NSEvent (LionSDK) |
| 96 | ++ (BOOL)isSwipeTrackingFromScrollEventsEnabled; |
| 97 | + |
| 98 | +- (NSEventPhase)phase; |
| 99 | +- (CGFloat)scrollingDeltaX; |
| 100 | +- (CGFloat)scrollingDeltaY; |
| 101 | +- (BOOL)isDirectionInvertedFromDevice; |
| 102 | +@end |
| 103 | + |
| 104 | +@interface NSScreen (LionSDK) |
| 105 | +- (CGFloat)backingScaleFactor; |
| 106 | +- (NSRect)convertRectToBacking:(NSRect)aRect; |
| 107 | +@end |
| 108 | + |
| 109 | +@interface NSWindow (LionSDK) |
| 110 | +- (CGFloat)backingScaleFactor; |
| 111 | +@end |
| 112 | + |
| 113 | +#endif // MAC_OS_X_VERSION_10_7 |
| 114 | + |
75 | 115 | // The Mac OS X 10.6 SDK introduced new protocols used for delegates. These |
76 | 116 | // protocol defintions were not present in earlier releases of the Mac OS X |
77 | 117 | // SDK. In order to support building against the new SDK, which requires |
@@ -108,6 +148,29 @@ DEFINE_EMPTY_PROTOCOL(NSWindowDelegate) |
108 | 148 |
|
109 | 149 | #endif // BUILDING_CEF_SHARED |
110 | 150 |
|
| 151 | +// Forward declarations for APIs that are part of the 10.7 SDK. This will allow |
| 152 | +// using them when building with the 10.6 SDK. |
| 153 | + |
| 154 | +#if !defined(MAC_OS_X_VERSION_10_7) || \ |
| 155 | + MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7 |
| 156 | + |
| 157 | +@interface NSView (NSOpenGLSurfaceResolutionLionAPI) |
| 158 | +- (void)setWantsBestResolutionOpenGLSurface:(BOOL)flag; |
| 159 | +@end |
| 160 | + |
| 161 | +@interface NSView (LionAPI) |
| 162 | +- (NSSize)convertSizeToBacking:(NSSize)aSize; |
| 163 | +- (NSRect)convertRectToBacking:(NSRect)aRect; |
| 164 | +- (NSRect)convertRectFromBacking:(NSRect)aRect; |
| 165 | +@end |
| 166 | + |
| 167 | +static NSString* const NSWindowDidChangeBackingPropertiesNotification = |
| 168 | + @"NSWindowDidChangeBackingPropertiesNotification"; |
| 169 | +static NSString* const NSBackingPropertyOldScaleFactorKey = |
| 170 | + @"NSBackingPropertyOldScaleFactorKey"; |
| 171 | + |
| 172 | +#endif // MAC_OS_X_VERSION_10_7 |
| 173 | + |
111 | 174 | // All CEF client applications must subclass NSApplication and implement this |
112 | 175 | // protocol. |
113 | 176 | @protocol CefAppProtocol<CrAppControlProtocol> |
|
0 commit comments