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
;
110 @interface
NSCursor (LionSDKDeclarations
)
111 + (NSCursor
*)IBeamCursorForVerticalLayout
;
114 @interface
NSAnimationContext (LionSDK
)
115 + (void)runAnimationGroup
:(void (^)(NSAnimationContext
*context
))changes
116 completionHandler
:(void (^)(void))completionHandler
;
117 @
property(copy
) void(^completionHandler
)(void);
120 @interface
NSView (LionSDK
)
121 - (NSSize
)convertSizeFromBacking
:(NSSize
)size
;
122 - (void)setWantsBestResolutionOpenGLSurface
:(BOOL
)flag
;
125 @interface
NSObject (ICCameraDeviceDelegateLionSDK
)
126 - (void)deviceDidBecomeReadyWithCompleteContentCatalog
:(ICDevice
*)device
;
127 - (void)didDownloadFile
:(ICCameraFile
*)file
128 error
:(NSError
*)error
129 options
:(NSDictionary
*)options
130 contextInfo
:(void*)contextInfo
;
133 @interface
NSScroller (LionSDK
)
134 + (NSInteger
)preferredScrollerStyle
;
137 @interface
CWInterface (LionSDK
)
138 - (BOOL
)associateToNetwork
:(CWNetwork
*)network
139 password
:(NSString
*)password
140 error
:(NSError
**)error
;
141 - (NSSet
*)scanForNetworksWithName
:(NSString
*)networkName
142 error
:(NSError
**)error
;
146 kCWChannelBandUnknown
= 0,
147 kCWChannelBand2GHz
= 1,
148 kCWChannelBand5GHz
= 2,
151 @interface CWChannel
: NSObject
152 @
property(readonly
) CWChannelBand channelBand
;
158 kCWSecurityWPAPersonal
= 2,
159 kCWSecurityWPAPersonalMixed
= 3,
160 kCWSecurityWPA2Personal
= 4,
161 kCWSecurityPersonal
= 5,
162 kCWSecurityDynamicWEP
= 6,
163 kCWSecurityWPAEnterprise
= 7,
164 kCWSecurityWPAEnterpriseMixed
= 8,
165 kCWSecurityWPA2Enterprise
= 9,
166 kCWSecurityEnterprise
= 10,
167 kCWSecurityUnknown
= NSIntegerMax
,
170 typedef NSInteger CWSecurity
;
172 @interface
CWNetwork (LionSDK
)
173 @
property(readonly
) CWChannel
* wlanChannel
;
174 @
property(readonly
) NSInteger rssiValue
;
175 - (BOOL
)supportsSecurity
:(CWSecurity
)security
;
178 @interface
IOBluetoothHostController (LionSDK
)
179 - (NSString
*)nameAsString
;
180 - (BluetoothHCIPowerState
)powerState
;
184 kBluetoothFeatureLESupportedController
= (1 << 6L),
187 @protocol IOBluetoothDeviceInquiryDelegate
188 - (void)deviceInquiryStarted
:(IOBluetoothDeviceInquiry
*)sender
;
189 - (void)deviceInquiryDeviceFound
:(IOBluetoothDeviceInquiry
*)sender
190 device
:(IOBluetoothDevice
*)device
;
191 - (void)deviceInquiryComplete
:(IOBluetoothDeviceInquiry
*)sender
192 error
:(IOReturn
)error
193 aborted
:(BOOL
)aborted
;
196 @interface
IOBluetoothL2CAPChannel (LionSDK
)
197 @
property(readonly
) BluetoothL2CAPMTU outgoingMTU
;
200 @interface
IOBluetoothDevice (LionSDK
)
201 - (NSString
*)addressString
;
202 - (unsigned int)classOfDevice
;
203 - (BluetoothConnectionHandle
)connectionHandle
;
204 - (BluetoothHCIRSSIValue
)rawRSSI
;
205 - (NSArray
*)services
;
206 - (IOReturn
)performSDPQuery
:(id
)target uuids
:(NSArray
*)uuids
;
209 BASE_EXPORT
extern "C" NSString
* const NSWindowWillEnterFullScreenNotification
;
211 #endif // MAC_OS_X_VERSION_10_7
213 #if !defined(MAC_OS_X_VERSION_10_8) || \
214 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
217 NSEventPhaseMayBegin
= 0x1 << 5
220 @interface
NSColor (MountainLionSDK
)
221 - (CGColorRef
)CGColor
;
224 #endif // MAC_OS_X_VERSION_10_8
227 #if !defined(MAC_OS_X_VERSION_10_9) || \
228 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
230 // NSProgress is public API in 10.9, but a version of it exists and is usable
233 @interface NSProgress
: NSObject
235 - (instancetype
)initWithParent
:(NSProgress
*)parentProgressOrNil
236 userInfo
:(NSDictionary
*)userInfoOrNil
;
237 @
property (copy
) NSString
* kind
;
239 @property
int64_t totalUnitCount
;
240 @property
int64_t completedUnitCount
;
242 @
property (getter
=isCancellable
) BOOL cancellable
;
243 @
property (getter
=isPausable
) BOOL pausable
;
244 @
property (readonly
, getter
=isCancelled
) BOOL cancelled
;
245 @
property (readonly
, getter
=isPaused
) BOOL paused
;
246 @
property (copy
) void (^cancellationHandler
)(void);
247 @
property (copy
) void (^pausingHandler
)(void);
251 - (void)setUserInfoObject
:(id
)objectOrNil forKey
:(NSString
*)key
;
252 - (NSDictionary
*)userInfo
;
254 @
property (readonly
, getter
=isIndeterminate
) BOOL indeterminate
;
255 @
property (readonly
) double fractionCompleted
;
262 @interface
NSScreen (MavericksSDK
)
263 + (BOOL
)screensHaveSeparateSpaces
;
266 @interface
NSView (MavericksSDK
)
267 - (void)setCanDrawSubviewsIntoLayer
:(BOOL
)flag
;
271 NSWindowOcclusionStateVisible
= 1UL << 1,
273 typedef NSUInteger NSWindowOcclusionState
;
275 @interface
NSWindow (MavericksSDK
)
276 - (NSWindowOcclusionState
)occlusionState
;
279 #else // !MAC_OS_X_VERSION_10_9
282 kCWSecurityModeOpen
= 0,
284 kCWSecurityModeWPA_PSK
,
285 kCWSecurityModeWPA2_PSK
,
286 kCWSecurityModeWPA_Enterprise
,
287 kCWSecurityModeWPA2_Enterprise
,
289 kCWSecurityModeDynamicWEP
292 @interface
CWNetwork (SnowLeopardSDK
)
293 @
property(readonly
) NSNumber
* rssi
;
294 @
property(readonly
) NSNumber
* securityMode
;
297 BASE_EXPORT
extern "C" NSString
* const kCWSSIDDidChangeNotification
;
299 #endif // MAC_OS_X_VERSION_10_9
301 #if !defined(MAC_OS_X_VERSION_10_10) || \
302 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
304 @interface NSUserActivity
: NSObject
306 @
property (readonly
, copy
) NSString
* activityType
;
307 @
property (copy
) NSURL
* webPageURL
;
311 BASE_EXPORT
extern "C" NSString
* const NSUserActivityTypeBrowsingWeb
;
313 #endif // MAC_OS_X_VERSION_10_10
315 #endif // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_