Roll breakpad a513e85:7caf028 (svn 1384:1385)
[chromium-blink-merge.git] / base / mac / sdk_forward_declarations.h
blob649d57248970f4eda0bf631f282e6d30f4b5948e
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
24 enum {
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;
34 enum {
35 NSFullScreenWindowMask = 1 << 14,
38 enum {
39 NSApplicationPresentationFullScreen = 1 << 10,
42 enum {
43 NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
44 NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8,
47 enum {
48 NSEventSwipeTrackingLockDirection = 0x1 << 0,
49 NSEventSwipeTrackingClampGestureAmount = 0x1 << 1,
51 typedef NSUInteger NSEventSwipeTrackingOptions;
53 enum {
54 NSWindowAnimationBehaviorDefault = 0,
55 NSWindowAnimationBehaviorNone = 2,
56 NSWindowAnimationBehaviorDocumentWindow = 3,
57 NSWindowAnimationBehaviorUtilityWindow = 4,
58 NSWindowAnimationBehaviorAlertPanel = 5
60 typedef NSInteger NSWindowAnimationBehavior;
62 enum {
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,
80 NSEventPhase phase,
81 BOOL isComplete,
82 BOOL *stop))trackingHandler;
84 - (BOOL)isDirectionInvertedFromDevice;
86 @end
88 @interface NSApplication (LionSDK)
89 - (void)disableRelaunchOnLogin;
90 @end
92 @interface CALayer (LionSDK)
93 - (CGFloat)contentsScale;
94 - (void)setContentsScale:(CGFloat)contentsScale;
95 @end
97 @interface NSScreen (LionSDK)
98 - (CGFloat)backingScaleFactor;
99 - (NSRect)convertRectToBacking:(NSRect)aRect;
100 @end
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 @end
110 @interface NSCursor (LionSDKDeclarations)
111 + (NSCursor*)IBeamCursorForVerticalLayout;
112 @end
114 @interface NSAnimationContext (LionSDK)
115 + (void)runAnimationGroup:(void (^)(NSAnimationContext *context))changes
116 completionHandler:(void (^)(void))completionHandler;
117 @property(copy) void(^completionHandler)(void);
118 @end
120 @interface NSView (LionSDK)
121 - (NSSize)convertSizeFromBacking:(NSSize)size;
122 - (void)setWantsBestResolutionOpenGLSurface:(BOOL)flag;
123 @end
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;
131 @end
133 @interface NSScroller (LionSDK)
134 + (NSInteger)preferredScrollerStyle;
135 @end
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;
143 @end
145 enum CWChannelBand {
146 kCWChannelBandUnknown = 0,
147 kCWChannelBand2GHz = 1,
148 kCWChannelBand5GHz = 2,
151 @interface CWChannel : NSObject
152 @property(readonly) CWChannelBand channelBand;
153 @end
155 enum {
156 kCWSecurityNone = 0,
157 kCWSecurityWEP = 1,
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;
176 @end
178 @interface IOBluetoothHostController (LionSDK)
179 - (NSString*)nameAsString;
180 - (BluetoothHCIPowerState)powerState;
181 @end
183 enum {
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;
194 @end
196 @interface IOBluetoothL2CAPChannel (LionSDK)
197 @property(readonly) BluetoothL2CAPMTU outgoingMTU;
198 @end
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;
207 @end
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
216 enum {
217 NSEventPhaseMayBegin = 0x1 << 5
220 @interface NSColor (MountainLionSDK)
221 - (CGColorRef)CGColor;
222 @end
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
231 // in 10.8.
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);
248 - (void)cancel;
249 - (void)pause;
251 - (void)setUserInfoObject:(id)objectOrNil forKey:(NSString*)key;
252 - (NSDictionary*)userInfo;
254 @property (readonly, getter=isIndeterminate) BOOL indeterminate;
255 @property (readonly) double fractionCompleted;
257 - (void)publish;
258 - (void)unpublish;
260 @end
262 @interface NSScreen (MavericksSDK)
263 + (BOOL)screensHaveSeparateSpaces;
264 @end
266 @interface NSView (MavericksSDK)
267 - (void)setCanDrawSubviewsIntoLayer:(BOOL)flag;
268 @end
270 enum {
271 NSWindowOcclusionStateVisible = 1UL << 1,
273 typedef NSUInteger NSWindowOcclusionState;
275 @interface NSWindow (MavericksSDK)
276 - (NSWindowOcclusionState)occlusionState;
277 @end
279 #else // !MAC_OS_X_VERSION_10_9
281 typedef enum {
282 kCWSecurityModeOpen = 0,
283 kCWSecurityModeWEP,
284 kCWSecurityModeWPA_PSK,
285 kCWSecurityModeWPA2_PSK,
286 kCWSecurityModeWPA_Enterprise,
287 kCWSecurityModeWPA2_Enterprise,
288 kCWSecurityModeWPS,
289 kCWSecurityModeDynamicWEP
290 } CWSecurityMode;
292 @interface CWNetwork (SnowLeopardSDK)
293 @property(readonly) NSNumber* rssi;
294 @property(readonly) NSNumber* securityMode;
295 @end
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;
309 @end
311 BASE_EXPORT extern "C" NSString* const NSUserActivityTypeBrowsingWeb;
313 #endif // MAC_OS_X_VERSION_10_10
315 #endif // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_