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 @interface
NSControl (MountainLionSDK
)
289 @property BOOL allowsExpansionToolTips
;
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
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);
319 - (void)setUserInfoObject
:(id
)objectOrNil forKey
:(NSString
*)key
;
320 - (NSDictionary
*)userInfo
;
322 @
property (readonly
, getter
=isIndeterminate
) BOOL indeterminate
;
323 @
property (readonly
) double fractionCompleted
;
330 @interface
NSScreen (MavericksSDK
)
331 + (BOOL
)screensHaveSeparateSpaces
;
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
;
342 @interface
NSView (MavericksSDK
)
343 - (void)setCanDrawSubviewsIntoLayer
:(BOOL
)flag
;
344 - (id
<CrNSAppearance
>)effectiveAppearance
;
348 NSWindowOcclusionStateVisible
= 1UL << 1,
350 typedef NSUInteger NSWindowOcclusionState
;
352 @interface
NSWindow (MavericksSDK
)
353 - (NSWindowOcclusionState
)occlusionState
;
357 BASE_EXPORT
extern "C" NSString
* const
358 NSWindowDidChangeOcclusionStateNotification
;
361 NSWorkspaceLaunchWithErrorPresentation
= 0x00000040
364 @interface
CBPeripheral (MavericksSDK
)
365 @
property(readonly
, nonatomic
) NSUUID
* identifier
;
368 BASE_EXPORT
extern "C" NSString
* const CBAdvertisementDataIsConnectable
;
370 #else // !MAC_OS_X_VERSION_10_9
373 kCWSecurityModeOpen
= 0,
375 kCWSecurityModeWPA_PSK
,
376 kCWSecurityModeWPA2_PSK
,
377 kCWSecurityModeWPA_Enterprise
,
378 kCWSecurityModeWPA2_Enterprise
,
380 kCWSecurityModeDynamicWEP
383 @interface
CWNetwork (SnowLeopardSDK
)
384 @
property(readonly
) NSNumber
* rssi
;
385 @
property(readonly
) NSNumber
* securityMode
;
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
;
407 BASE_EXPORT
extern "C" NSString
* const NSUserActivityTypeBrowsingWeb
;
409 BASE_EXPORT
extern "C" NSString
* const NSAppearanceNameVibrantDark
;
411 @interface
CBUUID (YosemiteSDK
)
412 - (NSString
*)UUIDString
;
415 #endif // MAC_OS_X_VERSION_10_10
417 #endif // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_