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 - (CGFloat
)scrollingDeltaX
;
74 - (CGFloat
)scrollingDeltaY
;
75 - (void)trackSwipeEventWithOptions
:(NSEventSwipeTrackingOptions
)options
76 dampenAmountThresholdMin
:(CGFloat
)minDampenThreshold
77 max
:(CGFloat
)maxDampenThreshold
78 usingHandler
:(void (^)(CGFloat gestureAmount
,
81 BOOL
*stop
))trackingHandler
;
83 - (BOOL
)isDirectionInvertedFromDevice
;
87 @interface
NSApplication (LionSDK
)
88 - (void)disableRelaunchOnLogin
;
91 @interface
CALayer (LionSDK
)
92 - (CGFloat
)contentsScale
;
93 - (void)setContentsScale
:(CGFloat
)contentsScale
;
96 @interface
NSScreen (LionSDK
)
97 - (CGFloat
)backingScaleFactor
;
98 - (NSRect
)convertRectToBacking
:(NSRect
)aRect
;
101 @interface
NSWindow (LionSDK
)
102 - (CGFloat
)backingScaleFactor
;
103 - (NSWindowAnimationBehavior
)animationBehavior
;
104 - (void)setAnimationBehavior
:(NSWindowAnimationBehavior
)newAnimationBehavior
;
105 - (void)toggleFullScreen
:(id
)sender
;
106 - (void)setRestorable
:(BOOL
)flag
;
109 @interface
NSCursor (LionSDKDeclarations
)
110 + (NSCursor
*)IBeamCursorForVerticalLayout
;
113 @interface
NSAnimationContext (LionSDK
)
114 + (void)runAnimationGroup
:(void (^)(NSAnimationContext
*context
))changes
115 completionHandler
:(void (^)(void))completionHandler
;
116 @
property(copy
) void(^completionHandler
)(void);
119 @interface
NSView (LionSDK
)
120 - (NSSize
)convertSizeFromBacking
:(NSSize
)size
;
121 - (void)setWantsBestResolutionOpenGLSurface
:(BOOL
)flag
;
124 @interface
NSObject (ICCameraDeviceDelegateLionSDK
)
125 - (void)deviceDidBecomeReadyWithCompleteContentCatalog
:(ICDevice
*)device
;
126 - (void)didDownloadFile
:(ICCameraFile
*)file
127 error
:(NSError
*)error
128 options
:(NSDictionary
*)options
129 contextInfo
:(void*)contextInfo
;
132 @interface
NSScroller (LionSDK
)
133 + (NSInteger
)preferredScrollerStyle
;
136 @interface
CWInterface (LionSDK
)
137 - (BOOL
)associateToNetwork
:(CWNetwork
*)network
138 password
:(NSString
*)password
139 error
:(NSError
**)error
;
140 - (NSSet
*)scanForNetworksWithName
:(NSString
*)networkName
141 error
:(NSError
**)error
;
145 kCWChannelBandUnknown
= 0,
146 kCWChannelBand2GHz
= 1,
147 kCWChannelBand5GHz
= 2,
150 @interface CWChannel
: NSObject
151 @
property(readonly
) CWChannelBand channelBand
;
154 @interface
CWNetwork (LionSDK
)
155 @
property(readonly
) CWChannel
* wlanChannel
;
158 @interface
IOBluetoothHostController (LionSDK
)
159 - (NSString
*)nameAsString
;
160 - (BluetoothHCIPowerState
)powerState
;
163 @protocol IOBluetoothDeviceInquiryDelegate
164 - (void)deviceInquiryStarted
:(IOBluetoothDeviceInquiry
*)sender
;
165 - (void)deviceInquiryDeviceFound
:(IOBluetoothDeviceInquiry
*)sender
166 device
:(IOBluetoothDevice
*)device
;
167 - (void)deviceInquiryComplete
:(IOBluetoothDeviceInquiry
*)sender
168 error
:(IOReturn
)error
169 aborted
:(BOOL
)aborted
;
172 @interface
IOBluetoothL2CAPChannel (LionSDK
)
173 @
property(readonly
) BluetoothL2CAPMTU outgoingMTU
;
176 @interface
IOBluetoothDevice (LionSDK
)
177 - (NSString
*)addressString
;
178 - (unsigned int)classOfDevice
;
179 - (BluetoothConnectionHandle
)connectionHandle
;
180 - (BluetoothHCIRSSIValue
)rawRSSI
;
181 - (NSArray
*)services
;
182 - (IOReturn
)performSDPQuery
:(id
)target uuids
:(NSArray
*)uuids
;
185 BASE_EXPORT
extern "C" NSString
* const NSWindowWillEnterFullScreenNotification
;
187 #endif // MAC_OS_X_VERSION_10_7
189 #if !defined(MAC_OS_X_VERSION_10_8) || \
190 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
193 NSEventPhaseMayBegin
= 0x1 << 5
196 #endif // MAC_OS_X_VERSION_10_8
199 #if !defined(MAC_OS_X_VERSION_10_9) || \
200 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
202 // NSProgress is public API in 10.9, but a version of it exists and is usable
205 @interface NSProgress
: NSObject
207 - (instancetype
)initWithParent
:(NSProgress
*)parentProgressOrNil
208 userInfo
:(NSDictionary
*)userInfoOrNil
;
209 @
property (copy
) NSString
* kind
;
211 @property
int64_t totalUnitCount
;
212 @property
int64_t completedUnitCount
;
214 @
property (getter
=isCancellable
) BOOL cancellable
;
215 @
property (getter
=isPausable
) BOOL pausable
;
216 @
property (readonly
, getter
=isCancelled
) BOOL cancelled
;
217 @
property (readonly
, getter
=isPaused
) BOOL paused
;
218 @
property (copy
) void (^cancellationHandler
)(void);
219 @
property (copy
) void (^pausingHandler
)(void);
223 - (void)setUserInfoObject
:(id
)objectOrNil forKey
:(NSString
*)key
;
224 - (NSDictionary
*)userInfo
;
226 @
property (readonly
, getter
=isIndeterminate
) BOOL indeterminate
;
227 @
property (readonly
) double fractionCompleted
;
234 @interface
NSView (MavericksSDK
)
235 - (void)setCanDrawSubviewsIntoLayer
:(BOOL
)flag
;
239 NSWindowOcclusionStateVisible
= 1UL << 1,
241 typedef NSUInteger NSWindowOcclusionState
;
243 @interface
NSWindow (MavericksSDK
)
244 - (NSWindowOcclusionState
)occlusionState
;
247 #endif // MAC_OS_X_VERSION_10_9
250 #if !defined(MAC_OS_X_VERSION_10_10) || \
251 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
254 NSWindowTitleVisible
= 0,
255 NSWindowTitleHidden
= 1,
256 NSWindowTitleHiddenWhenActive
= 2,
258 typedef NSInteger NSWindowTitleVisibility
;
260 @interface
NSWindow (YosemiteSDK
)
262 @property NSWindowTitleVisibility titleVisibility
;
266 #endif // MAC_OS_X_VERSION_10_10
268 #endif // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_