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
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
;
35 NSFullScreenWindowMask
= 1 << 14,
39 NSApplicationPresentationFullScreen
= 1 << 10,
43 NSWindowCollectionBehaviorFullScreenPrimary
= 1 << 7,
44 NSWindowCollectionBehaviorFullScreenAuxiliary
= 1 << 8,
48 NSEventSwipeTrackingLockDirection
= 0x1 << 0,
49 NSEventSwipeTrackingClampGestureAmount
= 0x1 << 1,
51 typedef NSUInteger NSEventSwipeTrackingOptions
;
54 NSWindowAnimationBehaviorDefault
= 0,
55 NSWindowAnimationBehaviorNone
= 2,
56 NSWindowAnimationBehaviorDocumentWindow
= 3,
57 NSWindowAnimationBehaviorUtilityWindow
= 4,
58 NSWindowAnimationBehaviorAlertPanel
= 5
60 typedef NSInteger NSWindowAnimationBehavior
;
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
,
82 BOOL
*stop
))trackingHandler
;
84 - (BOOL
)isDirectionInvertedFromDevice
;
88 @interface
NSApplication (LionSDK
)
89 - (void)disableRelaunchOnLogin
;
92 @interface
CALayer (LionSDK
)
93 - (CGFloat
)contentsScale
;
94 - (void)setContentsScale
:(CGFloat
)contentsScale
;
97 @interface
NSScreen (LionSDK
)
98 - (CGFloat
)backingScaleFactor
;
99 - (NSRect
)convertRectToBacking
:(NSRect
)aRect
;
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
;
111 @interface
NSCursor (LionSDKDeclarations
)
112 + (NSCursor
*)IBeamCursorForVerticalLayout
;
115 @interface
NSAnimationContext (LionSDK
)
116 + (void)runAnimationGroup
:(void (^)(NSAnimationContext
*context
))changes
117 completionHandler
:(void (^)(void))completionHandler
;
118 @
property(copy
) void(^completionHandler
)(void);
121 @interface
NSView (LionSDK
)
122 - (NSSize
)convertSizeFromBacking
:(NSSize
)size
;
123 - (void)setWantsBestResolutionOpenGLSurface
:(BOOL
)flag
;
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
;
134 @interface
NSScroller (LionSDK
)
135 + (NSInteger
)preferredScrollerStyle
;
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
;
147 kCWChannelBandUnknown
= 0,
148 kCWChannelBand2GHz
= 1,
149 kCWChannelBand5GHz
= 2,
152 @interface CWChannel
: NSObject
153 @
property(readonly
) CWChannelBand channelBand
;
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
;
179 @interface
IOBluetoothHostController (LionSDK
)
180 - (NSString
*)nameAsString
;
181 - (BluetoothHCIPowerState
)powerState
;
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
;
197 @interface
IOBluetoothL2CAPChannel (LionSDK
)
198 @
property(readonly
) BluetoothL2CAPMTU outgoingMTU
;
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
;
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
;
222 BASE_EXPORT
extern "C" NSString
* const CBAdvertisementDataServiceDataKey
;
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
;
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
;
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
;
266 @interface CBUUID
: NSObject
267 @
property(nonatomic
, readonly
) NSData
* data
;
268 + (CBUUID
*)UUIDWithString
:(NSString
*)theString
;
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
277 NSEventPhaseMayBegin
= 0x1 << 5
280 @interface
NSColor (MountainLionSDK
)
281 - (CGColorRef
)CGColor
;
284 @interface NSUUID
: NSObject
285 - (NSString
*)UUIDString
;
288 #endif // MAC_OS_X_VERSION_10_8
291 #if !defined(MAC_OS_X_VERSION_10_9) || \
292 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
294 // NSProgress is public API in 10.9, but a version of it exists and is usable
297 @interface NSProgress
: NSObject
299 - (instancetype
)initWithParent
:(NSProgress
*)parentProgressOrNil
300 userInfo
:(NSDictionary
*)userInfoOrNil
;
301 @
property (copy
) NSString
* kind
;
303 @property
int64_t totalUnitCount
;
304 @property
int64_t completedUnitCount
;
306 @
property (getter
=isCancellable
) BOOL cancellable
;
307 @
property (getter
=isPausable
) BOOL pausable
;
308 @
property (readonly
, getter
=isCancelled
) BOOL cancelled
;
309 @
property (readonly
, getter
=isPaused
) BOOL paused
;
310 @
property (copy
) void (^cancellationHandler
)(void);
311 @
property (copy
) void (^pausingHandler
)(void);
315 - (void)setUserInfoObject
:(id
)objectOrNil forKey
:(NSString
*)key
;
316 - (NSDictionary
*)userInfo
;
318 @
property (readonly
, getter
=isIndeterminate
) BOOL indeterminate
;
319 @
property (readonly
) double fractionCompleted
;
326 @interface
NSScreen (MavericksSDK
)
327 + (BOOL
)screensHaveSeparateSpaces
;
330 // NSAppearance is a new class in the 10.9 SDK. New classes cannot be
331 // forward-declared because they also require an @implementation, which would
332 // produce conflicting linkage. Instead, just declare the necessary pieces of
333 // the interface as a protocol, and treat objects of this type as id.
334 @protocol CrNSAppearance
<NSObject
>
335 + (id
<NSObject
>)appearanceNamed
:(NSString
*)name
;
338 @interface
NSView (MavericksSDK
)
339 - (void)setCanDrawSubviewsIntoLayer
:(BOOL
)flag
;
340 - (id
<CrNSAppearance
>)effectiveAppearance
;
344 NSWindowOcclusionStateVisible
= 1UL << 1,
346 typedef NSUInteger NSWindowOcclusionState
;
348 @interface
NSWindow (MavericksSDK
)
349 - (NSWindowOcclusionState
)occlusionState
;
353 BASE_EXPORT
extern "C" NSString
* const
354 NSWindowDidChangeOcclusionStateNotification
;
357 NSWorkspaceLaunchWithErrorPresentation
= 0x00000040
360 @interface
CBPeripheral (MavericksSDK
)
361 @
property(readonly
, nonatomic
) NSUUID
* identifier
;
364 BASE_EXPORT
extern "C" NSString
* const CBAdvertisementDataIsConnectable
;
366 #else // !MAC_OS_X_VERSION_10_9
369 kCWSecurityModeOpen
= 0,
371 kCWSecurityModeWPA_PSK
,
372 kCWSecurityModeWPA2_PSK
,
373 kCWSecurityModeWPA_Enterprise
,
374 kCWSecurityModeWPA2_Enterprise
,
376 kCWSecurityModeDynamicWEP
379 @interface
CWNetwork (SnowLeopardSDK
)
380 @
property(readonly
) NSNumber
* rssi
;
381 @
property(readonly
) NSNumber
* securityMode
;
384 BASE_EXPORT
extern "C" NSString
* const kCWSSIDDidChangeNotification
;
386 #endif // MAC_OS_X_VERSION_10_9
388 #if !defined(MAC_OS_X_VERSION_10_10) || \
389 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
391 @interface NSUserActivity
: NSObject
393 @
property (readonly
, copy
) NSString
* activityType
;
394 @
property (copy
) NSDictionary
* userInfo
;
395 @
property (copy
) NSURL
* webpageURL
;
397 - (instancetype
)initWithActivityType
:(NSString
*)activityType
;
398 - (void)becomeCurrent
;
403 BASE_EXPORT
extern "C" NSString
* const NSUserActivityTypeBrowsingWeb
;
405 BASE_EXPORT
extern "C" NSString
* const NSAppearanceNameVibrantDark
;
407 @interface
CBUUID (YosemiteSDK
)
408 - (NSString
*)UUIDString
;
411 #endif // MAC_OS_X_VERSION_10_10
413 #endif // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_