Reland "mac: Implement custom AppKit Enter Fullscreen transition."
[chromium-blink-merge.git] / base / mac / sdk_forward_declarations.h
blobfaa36eac512c34f71b7c47c8040f63c0fa39b8dd
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.
5 // This file contains forward declarations for items in later SDKs than the
6 // default one with which Chromium is built (currently 10.6).
7 // If you call any function from this header, be sure to check at runtime for
8 // respondsToSelector: before calling these functions (else your code will crash
9 // on older OS X versions that chrome still supports).
11 #ifndef BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
12 #define BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
14 #import <AppKit/AppKit.h>
15 #import <CoreWLAN/CoreWLAN.h>
16 #import <ImageCaptureCore/ImageCaptureCore.h>
17 #import <IOBluetooth/IOBluetooth.h>
19 #include "base/base_export.h"
21 #if !defined(MAC_OS_X_VERSION_10_7) || \
22 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
24 enum {
25 NSEventPhaseNone = 0, // event not associated with a phase.
26 NSEventPhaseBegan = 0x1 << 0,
27 NSEventPhaseStationary = 0x1 << 1,
28 NSEventPhaseChanged = 0x1 << 2,
29 NSEventPhaseEnded = 0x1 << 3,
30 NSEventPhaseCancelled = 0x1 << 4
32 typedef NSUInteger NSEventPhase;
34 enum {
35 NSFullScreenWindowMask = 1 << 14,
38 enum {
39 NSApplicationPresentationFullScreen = 1 << 10,
42 enum {
43 NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
44 NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8,
47 enum {
48 NSEventSwipeTrackingLockDirection = 0x1 << 0,
49 NSEventSwipeTrackingClampGestureAmount = 0x1 << 1,
51 typedef NSUInteger NSEventSwipeTrackingOptions;
53 enum {
54 NSWindowAnimationBehaviorDefault = 0,
55 NSWindowAnimationBehaviorNone = 2,
56 NSWindowAnimationBehaviorDocumentWindow = 3,
57 NSWindowAnimationBehaviorUtilityWindow = 4,
58 NSWindowAnimationBehaviorAlertPanel = 5
60 typedef NSInteger NSWindowAnimationBehavior;
62 enum {
63 NSWindowDocumentVersionsButton = 6,
64 NSWindowFullScreenButton,
66 typedef NSUInteger NSWindowButton;
68 @interface NSEvent (LionSDK)
69 + (BOOL)isSwipeTrackingFromScrollEventsEnabled;
71 - (NSEventPhase)momentumPhase;
72 - (NSEventPhase)phase;
73 - (BOOL)hasPreciseScrollingDeltas;
74 - (CGFloat)scrollingDeltaX;
75 - (CGFloat)scrollingDeltaY;
76 - (void)trackSwipeEventWithOptions:(NSEventSwipeTrackingOptions)options
77 dampenAmountThresholdMin:(CGFloat)minDampenThreshold
78 max:(CGFloat)maxDampenThreshold
79 usingHandler:(void (^)(CGFloat gestureAmount,
80 NSEventPhase phase,
81 BOOL isComplete,
82 BOOL *stop))trackingHandler;
84 - (BOOL)isDirectionInvertedFromDevice;
86 @end
88 @interface NSApplication (LionSDK)
89 - (void)disableRelaunchOnLogin;
90 @end
92 @interface CALayer (LionSDK)
93 - (CGFloat)contentsScale;
94 - (void)setContentsScale:(CGFloat)contentsScale;
95 @end
97 @interface NSScreen (LionSDK)
98 - (CGFloat)backingScaleFactor;
99 - (NSRect)convertRectToBacking:(NSRect)aRect;
100 @end
102 @interface NSWindow (LionSDK)
103 - (CGFloat)backingScaleFactor;
104 - (NSWindowAnimationBehavior)animationBehavior;
105 - (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior;
106 - (void)toggleFullScreen:(id)sender;
107 - (void)setRestorable:(BOOL)flag;
108 - (NSRect)convertRectFromScreen:(NSRect)aRect;
109 @end
111 @interface NSCursor (LionSDKDeclarations)
112 + (NSCursor*)IBeamCursorForVerticalLayout;
113 @end
115 @interface NSAnimationContext (LionSDK)
116 + (void)runAnimationGroup:(void (^)(NSAnimationContext *context))changes
117 completionHandler:(void (^)(void))completionHandler;
118 @property(copy) void(^completionHandler)(void);
119 @end
121 @interface NSView (LionSDK)
122 - (NSSize)convertSizeFromBacking:(NSSize)size;
123 - (void)setWantsBestResolutionOpenGLSurface:(BOOL)flag;
124 @end
126 @interface NSObject (ICCameraDeviceDelegateLionSDK)
127 - (void)deviceDidBecomeReadyWithCompleteContentCatalog:(ICDevice*)device;
128 - (void)didDownloadFile:(ICCameraFile*)file
129 error:(NSError*)error
130 options:(NSDictionary*)options
131 contextInfo:(void*)contextInfo;
132 @end
134 @interface NSScroller (LionSDK)
135 + (NSInteger)preferredScrollerStyle;
136 @end
138 @interface CWInterface (LionSDK)
139 - (BOOL)associateToNetwork:(CWNetwork*)network
140 password:(NSString*)password
141 error:(NSError**)error;
142 - (NSSet*)scanForNetworksWithName:(NSString*)networkName
143 error:(NSError**)error;
144 @end
146 enum CWChannelBand {
147 kCWChannelBandUnknown = 0,
148 kCWChannelBand2GHz = 1,
149 kCWChannelBand5GHz = 2,
152 @interface CWChannel : NSObject
153 @property(readonly) CWChannelBand channelBand;
154 @end
156 enum {
157 kCWSecurityNone = 0,
158 kCWSecurityWEP = 1,
159 kCWSecurityWPAPersonal = 2,
160 kCWSecurityWPAPersonalMixed = 3,
161 kCWSecurityWPA2Personal = 4,
162 kCWSecurityPersonal = 5,
163 kCWSecurityDynamicWEP = 6,
164 kCWSecurityWPAEnterprise = 7,
165 kCWSecurityWPAEnterpriseMixed = 8,
166 kCWSecurityWPA2Enterprise = 9,
167 kCWSecurityEnterprise = 10,
168 kCWSecurityUnknown = NSIntegerMax,
171 typedef NSInteger CWSecurity;
173 @interface CWNetwork (LionSDK)
174 @property(readonly) CWChannel* wlanChannel;
175 @property(readonly) NSInteger rssiValue;
176 - (BOOL)supportsSecurity:(CWSecurity)security;
177 @end
179 @interface IOBluetoothHostController (LionSDK)
180 - (NSString*)nameAsString;
181 - (BluetoothHCIPowerState)powerState;
182 @end
184 enum {
185 kBluetoothFeatureLESupportedController = (1 << 6L),
188 @protocol IOBluetoothDeviceInquiryDelegate
189 - (void)deviceInquiryStarted:(IOBluetoothDeviceInquiry*)sender;
190 - (void)deviceInquiryDeviceFound:(IOBluetoothDeviceInquiry*)sender
191 device:(IOBluetoothDevice*)device;
192 - (void)deviceInquiryComplete:(IOBluetoothDeviceInquiry*)sender
193 error:(IOReturn)error
194 aborted:(BOOL)aborted;
195 @end
197 @interface IOBluetoothL2CAPChannel (LionSDK)
198 @property(readonly) BluetoothL2CAPMTU outgoingMTU;
199 @end
201 @interface IOBluetoothDevice (LionSDK)
202 - (NSString*)addressString;
203 - (unsigned int)classOfDevice;
204 - (BluetoothConnectionHandle)connectionHandle;
205 - (BluetoothHCIRSSIValue)rawRSSI;
206 - (NSArray*)services;
207 - (IOReturn)performSDPQuery:(id)target uuids:(NSArray*)uuids;
208 @end
210 BASE_EXPORT extern "C" NSString* const NSWindowWillEnterFullScreenNotification;
211 BASE_EXPORT extern "C" NSString* const NSWindowWillExitFullScreenNotification;
212 BASE_EXPORT extern "C" NSString* const NSWindowDidEnterFullScreenNotification;
213 BASE_EXPORT extern "C" NSString* const NSWindowDidExitFullScreenNotification;
214 BASE_EXPORT extern "C" NSString* const
215 NSWindowDidChangeBackingPropertiesNotification;
217 @protocol NSWindowDelegateFullScreenAdditions
218 - (void)windowDidFailToEnterFullScreen:(NSWindow*)window;
219 - (void)windowDidFailToExitFullScreen:(NSWindow*)window;
220 @end
222 #endif // MAC_OS_X_VERSION_10_7
224 #if !defined(MAC_OS_X_VERSION_10_8) || \
225 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
227 enum {
228 NSEventPhaseMayBegin = 0x1 << 5
231 @interface NSColor (MountainLionSDK)
232 - (CGColorRef)CGColor;
233 @end
235 #endif // MAC_OS_X_VERSION_10_8
238 #if !defined(MAC_OS_X_VERSION_10_9) || \
239 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
241 // NSProgress is public API in 10.9, but a version of it exists and is usable
242 // in 10.8.
244 @interface NSProgress : NSObject
246 - (instancetype)initWithParent:(NSProgress*)parentProgressOrNil
247 userInfo:(NSDictionary*)userInfoOrNil;
248 @property (copy) NSString* kind;
250 @property int64_t totalUnitCount;
251 @property int64_t completedUnitCount;
253 @property (getter=isCancellable) BOOL cancellable;
254 @property (getter=isPausable) BOOL pausable;
255 @property (readonly, getter=isCancelled) BOOL cancelled;
256 @property (readonly, getter=isPaused) BOOL paused;
257 @property (copy) void (^cancellationHandler)(void);
258 @property (copy) void (^pausingHandler)(void);
259 - (void)cancel;
260 - (void)pause;
262 - (void)setUserInfoObject:(id)objectOrNil forKey:(NSString*)key;
263 - (NSDictionary*)userInfo;
265 @property (readonly, getter=isIndeterminate) BOOL indeterminate;
266 @property (readonly) double fractionCompleted;
268 - (void)publish;
269 - (void)unpublish;
271 @end
273 @interface NSScreen (MavericksSDK)
274 + (BOOL)screensHaveSeparateSpaces;
275 @end
277 // NSAppearance is a new class in the 10.9 SDK. New classes cannot be
278 // forward-declared because they also require an @implementation, which would
279 // produce conflicting linkage. Instead, just declare the necessary pieces of
280 // the interface as a protocol, and treat objects of this type as id.
281 @protocol CrNSAppearance<NSObject>
282 + (id<NSObject>)appearanceNamed:(NSString*)name;
283 @end
285 @interface NSView (MavericksSDK)
286 - (void)setCanDrawSubviewsIntoLayer:(BOOL)flag;
287 - (id<CrNSAppearance>)effectiveAppearance;
288 @end
290 enum {
291 NSWindowOcclusionStateVisible = 1UL << 1,
293 typedef NSUInteger NSWindowOcclusionState;
295 @interface NSWindow (MavericksSDK)
296 - (NSWindowOcclusionState)occlusionState;
297 @end
300 BASE_EXPORT extern "C" NSString* const
301 NSWindowDidChangeOcclusionStateNotification;
303 enum {
304 NSWorkspaceLaunchWithErrorPresentation = 0x00000040
307 #else // !MAC_OS_X_VERSION_10_9
309 typedef enum {
310 kCWSecurityModeOpen = 0,
311 kCWSecurityModeWEP,
312 kCWSecurityModeWPA_PSK,
313 kCWSecurityModeWPA2_PSK,
314 kCWSecurityModeWPA_Enterprise,
315 kCWSecurityModeWPA2_Enterprise,
316 kCWSecurityModeWPS,
317 kCWSecurityModeDynamicWEP
318 } CWSecurityMode;
320 @interface CWNetwork (SnowLeopardSDK)
321 @property(readonly) NSNumber* rssi;
322 @property(readonly) NSNumber* securityMode;
323 @end
325 BASE_EXPORT extern "C" NSString* const kCWSSIDDidChangeNotification;
327 #endif // MAC_OS_X_VERSION_10_9
329 #if !defined(MAC_OS_X_VERSION_10_10) || \
330 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
332 @interface NSUserActivity : NSObject
334 @property (readonly, copy) NSString* activityType;
335 @property (copy) NSDictionary* userInfo;
336 @property (copy) NSURL* webpageURL;
338 - (instancetype)initWithActivityType:(NSString*)activityType;
339 - (void)becomeCurrent;
340 - (void)invalidate;
342 @end
344 BASE_EXPORT extern "C" NSString* const NSUserActivityTypeBrowsingWeb;
346 BASE_EXPORT extern "C" NSString* const NSAppearanceNameVibrantDark;
348 #endif // MAC_OS_X_VERSION_10_10
350 #endif // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_