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
;
210 BASE_EXPORT
extern "C" NSString
* const NSWindowWillExitFullScreenNotification
;
211 BASE_EXPORT
extern "C" NSString
* const NSWindowDidEnterFullScreenNotification
;
212 BASE_EXPORT
extern "C" NSString
* const NSWindowDidExitFullScreenNotification
;
213 BASE_EXPORT
extern "C" NSString
* const
214 NSWindowDidChangeBackingPropertiesNotification
;
216 @protocol NSWindowDelegateFullScreenAdditions
217 - (void)windowDidFailToEnterFullScreen
:(NSWindow
*)window
;
218 - (void)windowDidFailToExitFullScreen
:(NSWindow
*)window
;
221 #endif // MAC_OS_X_VERSION_10_7
223 #if !defined(MAC_OS_X_VERSION_10_8) || \
224 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
227 NSEventPhaseMayBegin
= 0x1 << 5
230 @interface
NSColor (MountainLionSDK
)
231 - (CGColorRef
)CGColor
;
234 #endif // MAC_OS_X_VERSION_10_8
237 #if !defined(MAC_OS_X_VERSION_10_9) || \
238 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
240 // NSProgress is public API in 10.9, but a version of it exists and is usable
243 @interface NSProgress
: NSObject
245 - (instancetype
)initWithParent
:(NSProgress
*)parentProgressOrNil
246 userInfo
:(NSDictionary
*)userInfoOrNil
;
247 @
property (copy
) NSString
* kind
;
249 @property
int64_t totalUnitCount
;
250 @property
int64_t completedUnitCount
;
252 @
property (getter
=isCancellable
) BOOL cancellable
;
253 @
property (getter
=isPausable
) BOOL pausable
;
254 @
property (readonly
, getter
=isCancelled
) BOOL cancelled
;
255 @
property (readonly
, getter
=isPaused
) BOOL paused
;
256 @
property (copy
) void (^cancellationHandler
)(void);
257 @
property (copy
) void (^pausingHandler
)(void);
261 - (void)setUserInfoObject
:(id
)objectOrNil forKey
:(NSString
*)key
;
262 - (NSDictionary
*)userInfo
;
264 @
property (readonly
, getter
=isIndeterminate
) BOOL indeterminate
;
265 @
property (readonly
) double fractionCompleted
;
272 @interface
NSScreen (MavericksSDK
)
273 + (BOOL
)screensHaveSeparateSpaces
;
276 // NSAppearance is a new class in the 10.9 SDK. New classes cannot be
277 // forward-declared because they also require an @implementation, which would
278 // produce conflicting linkage. Instead, just declare the necessary pieces of
279 // the interface as a protocol, and treat objects of this type as id.
280 @protocol CrNSAppearance
<NSObject
>
281 + (id
<NSObject
>)appearanceNamed
:(NSString
*)name
;
284 @interface
NSView (MavericksSDK
)
285 - (void)setCanDrawSubviewsIntoLayer
:(BOOL
)flag
;
286 - (id
<CrNSAppearance
>)effectiveAppearance
;
290 NSWindowOcclusionStateVisible
= 1UL << 1,
292 typedef NSUInteger NSWindowOcclusionState
;
294 @interface
NSWindow (MavericksSDK
)
295 - (NSWindowOcclusionState
)occlusionState
;
299 BASE_EXPORT
extern "C" NSString
* const
300 NSWindowDidChangeOcclusionStateNotification
;
303 NSWorkspaceLaunchWithErrorPresentation
= 0x00000040
306 #else // !MAC_OS_X_VERSION_10_9
309 kCWSecurityModeOpen
= 0,
311 kCWSecurityModeWPA_PSK
,
312 kCWSecurityModeWPA2_PSK
,
313 kCWSecurityModeWPA_Enterprise
,
314 kCWSecurityModeWPA2_Enterprise
,
316 kCWSecurityModeDynamicWEP
319 @interface
CWNetwork (SnowLeopardSDK
)
320 @
property(readonly
) NSNumber
* rssi
;
321 @
property(readonly
) NSNumber
* securityMode
;
324 BASE_EXPORT
extern "C" NSString
* const kCWSSIDDidChangeNotification
;
326 #endif // MAC_OS_X_VERSION_10_9
328 #if !defined(MAC_OS_X_VERSION_10_10) || \
329 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
331 @interface NSUserActivity
: NSObject
333 @
property (readonly
, copy
) NSString
* activityType
;
334 @
property (copy
) NSDictionary
* userInfo
;
335 @
property (copy
) NSURL
* webPageURL
;
339 BASE_EXPORT
extern "C" NSString
* const NSUserActivityTypeBrowsingWeb
;
341 BASE_EXPORT
extern "C" NSString
* const NSAppearanceNameVibrantDark
;
343 #endif // MAC_OS_X_VERSION_10_10
345 #endif // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_