Roll src/third_party/WebKit f36d5e0:68b67cd (svn 193299:193303)
[chromium-blink-merge.git] / base / mac / sdk_forward_declarations.h
blob25d937e0120a255bd66f62fa4c549e4fde253879
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 BASE_EXPORT extern "C" NSString* const CBAdvertisementDataServiceDataKey;
224 enum {
225 CBPeripheralStateDisconnected = 0,
226 CBPeripheralStateConnecting,
227 CBPeripheralStateConnected,
229 typedef NSInteger CBPeripheralState;
231 @interface CBPeripheral : NSObject
232 @property(readonly, nonatomic) CFUUIDRef UUID;
233 @property(retain, readonly) NSString* name;
234 @property(readonly) BOOL isConnected;
235 @end
237 enum {
238 CBCentralManagerStateUnknown = 0,
239 CBCentralManagerStateResetting,
240 CBCentralManagerStateUnsupported,
241 CBCentralManagerStateUnauthorized,
242 CBCentralManagerStatePoweredOff,
243 CBCentralManagerStatePoweredOn,
245 typedef NSInteger CBCentralManagerState;
247 @protocol CBCentralManagerDelegate;
249 @interface CBCentralManager : NSObject
250 @property(readonly) CBCentralManagerState state;
251 - (id)initWithDelegate:(id<CBCentralManagerDelegate>)delegate
252 queue:(dispatch_queue_t)queue;
253 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs
254 options:(NSDictionary*)options;
255 - (void)stopScan;
256 @end
258 @protocol CBCentralManagerDelegate<NSObject>
259 - (void)centralManagerDidUpdateState:(CBCentralManager*)central;
260 - (void)centralManager:(CBCentralManager*)central
261 didDiscoverPeripheral:(CBPeripheral*)peripheral
262 advertisementData:(NSDictionary*)advertisementData
263 RSSI:(NSNumber*)RSSI;
264 @end
266 @interface CBUUID : NSObject
267 @property(nonatomic, readonly) NSData* data;
268 + (CBUUID*)UUIDWithString:(NSString*)theString;
269 @end
271 #endif // MAC_OS_X_VERSION_10_7
273 #if !defined(MAC_OS_X_VERSION_10_8) || \
274 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
276 enum {
277 NSEventPhaseMayBegin = 0x1 << 5
280 @interface NSColor (MountainLionSDK)
281 - (CGColorRef)CGColor;
282 @end
284 @interface NSUUID : NSObject
285 - (NSString*)UUIDString;
286 @end
288 @interface NSControl (MountainLionSDK)
289 @property BOOL allowsExpansionToolTips;
290 @end
292 #endif // MAC_OS_X_VERSION_10_8
295 #if !defined(MAC_OS_X_VERSION_10_9) || \
296 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
298 // NSProgress is public API in 10.9, but a version of it exists and is usable
299 // in 10.8.
301 @interface NSProgress : NSObject
303 - (instancetype)initWithParent:(NSProgress*)parentProgressOrNil
304 userInfo:(NSDictionary*)userInfoOrNil;
305 @property (copy) NSString* kind;
307 @property int64_t totalUnitCount;
308 @property int64_t completedUnitCount;
310 @property (getter=isCancellable) BOOL cancellable;
311 @property (getter=isPausable) BOOL pausable;
312 @property (readonly, getter=isCancelled) BOOL cancelled;
313 @property (readonly, getter=isPaused) BOOL paused;
314 @property (copy) void (^cancellationHandler)(void);
315 @property (copy) void (^pausingHandler)(void);
316 - (void)cancel;
317 - (void)pause;
319 - (void)setUserInfoObject:(id)objectOrNil forKey:(NSString*)key;
320 - (NSDictionary*)userInfo;
322 @property (readonly, getter=isIndeterminate) BOOL indeterminate;
323 @property (readonly) double fractionCompleted;
325 - (void)publish;
326 - (void)unpublish;
328 @end
330 @interface NSScreen (MavericksSDK)
331 + (BOOL)screensHaveSeparateSpaces;
332 @end
334 // NSAppearance is a new class in the 10.9 SDK. New classes cannot be
335 // forward-declared because they also require an @implementation, which would
336 // produce conflicting linkage. Instead, just declare the necessary pieces of
337 // the interface as a protocol, and treat objects of this type as id.
338 @protocol CrNSAppearance<NSObject>
339 + (id<NSObject>)appearanceNamed:(NSString*)name;
340 @end
342 @interface NSView (MavericksSDK)
343 - (void)setCanDrawSubviewsIntoLayer:(BOOL)flag;
344 - (id<CrNSAppearance>)effectiveAppearance;
345 @end
347 enum {
348 NSWindowOcclusionStateVisible = 1UL << 1,
350 typedef NSUInteger NSWindowOcclusionState;
352 @interface NSWindow (MavericksSDK)
353 - (NSWindowOcclusionState)occlusionState;
354 @end
357 BASE_EXPORT extern "C" NSString* const
358 NSWindowDidChangeOcclusionStateNotification;
360 enum {
361 NSWorkspaceLaunchWithErrorPresentation = 0x00000040
364 @interface CBPeripheral (MavericksSDK)
365 @property(readonly, nonatomic) NSUUID* identifier;
366 @end
368 BASE_EXPORT extern "C" NSString* const CBAdvertisementDataIsConnectable;
370 #else // !MAC_OS_X_VERSION_10_9
372 typedef enum {
373 kCWSecurityModeOpen = 0,
374 kCWSecurityModeWEP,
375 kCWSecurityModeWPA_PSK,
376 kCWSecurityModeWPA2_PSK,
377 kCWSecurityModeWPA_Enterprise,
378 kCWSecurityModeWPA2_Enterprise,
379 kCWSecurityModeWPS,
380 kCWSecurityModeDynamicWEP
381 } CWSecurityMode;
383 @interface CWNetwork (SnowLeopardSDK)
384 @property(readonly) NSNumber* rssi;
385 @property(readonly) NSNumber* securityMode;
386 @end
388 BASE_EXPORT extern "C" NSString* const kCWSSIDDidChangeNotification;
390 #endif // MAC_OS_X_VERSION_10_9
392 #if !defined(MAC_OS_X_VERSION_10_10) || \
393 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
395 @interface NSUserActivity : NSObject
397 @property (readonly, copy) NSString* activityType;
398 @property (copy) NSDictionary* userInfo;
399 @property (copy) NSURL* webpageURL;
401 - (instancetype)initWithActivityType:(NSString*)activityType;
402 - (void)becomeCurrent;
403 - (void)invalidate;
405 @end
407 BASE_EXPORT extern "C" NSString* const NSUserActivityTypeBrowsingWeb;
409 BASE_EXPORT extern "C" NSString* const NSAppearanceNameVibrantDark;
411 @interface CBUUID (YosemiteSDK)
412 - (NSString*)UUIDString;
413 @end
415 #endif // MAC_OS_X_VERSION_10_10
417 #endif // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_