roll libyuv to r1450 from r1444. Adds direct YUY2ToNV12 and UYVYToNV12 conversions...
[chromium-blink-merge.git] / base / mac / sdk_forward_declarations.h
blobe45ab43eccbb86254e00d27cb53fba2010088c57
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 // ----------------------------------------------------------------------------
22 // Either define or forward declare classes only available in OSX 10.7+.
23 // ----------------------------------------------------------------------------
25 #if !defined(MAC_OS_X_VERSION_10_7) || \
26 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
28 @interface CWChannel : NSObject
29 @end
31 @interface CBPeripheral : NSObject
32 @end
34 @interface CBCentralManager : NSObject
35 @end
37 @interface CBUUID : NSObject
38 @end
40 #else
42 @class CWChannel;
43 @class CBPeripheral;
44 @class CBCentralManager;
45 @class CBUUID;
47 #endif // MAC_OS_X_VERSION_10_7
49 #if !defined(MAC_OS_X_VERSION_10_8) || \
50 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
52 @interface NSUUID : NSObject
53 @end
55 #else
57 @class NSUUID;
59 #endif // MAC_OS_X_VERSION_10_8
61 #if !defined(MAC_OS_X_VERSION_10_9) || \
62 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
64 // NSProgress is public API in 10.9, but a version of it exists and is usable
65 // in 10.8.
66 @interface NSProgress : NSObject
67 @end
69 @interface NSAppearance : NSObject
70 @end
72 #else
74 @class NSProgress;
75 @class NSAppearance;
77 #endif // MAC_OS_X_VERSION_10_9
79 #if !defined(MAC_OS_X_VERSION_10_10) || \
80 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
82 @interface NSUserActivity : NSObject
83 @end
85 #else
87 @class NSUserActivity;
89 #endif // MAC_OS_X_VERSION_10_10
91 // ----------------------------------------------------------------------------
92 // Define typedefs, enums, and protocols not available in the version of the
93 // OSX SDK being compiled against.
94 // ----------------------------------------------------------------------------
96 #if !defined(MAC_OS_X_VERSION_10_7) || \
97 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
99 enum {
100 NSEventPhaseNone = 0, // event not associated with a phase.
101 NSEventPhaseBegan = 0x1 << 0,
102 NSEventPhaseStationary = 0x1 << 1,
103 NSEventPhaseChanged = 0x1 << 2,
104 NSEventPhaseEnded = 0x1 << 3,
105 NSEventPhaseCancelled = 0x1 << 4
107 typedef NSUInteger NSEventPhase;
109 enum {
110 NSFullScreenWindowMask = 1 << 14,
113 enum {
114 NSApplicationPresentationFullScreen = 1 << 10,
117 enum {
118 NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
119 NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8,
122 enum {
123 NSEventSwipeTrackingLockDirection = 0x1 << 0,
124 NSEventSwipeTrackingClampGestureAmount = 0x1 << 1,
126 typedef NSUInteger NSEventSwipeTrackingOptions;
128 enum {
129 NSWindowAnimationBehaviorDefault = 0,
130 NSWindowAnimationBehaviorNone = 2,
131 NSWindowAnimationBehaviorDocumentWindow = 3,
132 NSWindowAnimationBehaviorUtilityWindow = 4,
133 NSWindowAnimationBehaviorAlertPanel = 5
135 typedef NSInteger NSWindowAnimationBehavior;
137 enum {
138 NSWindowDocumentVersionsButton = 6,
139 NSWindowFullScreenButton,
141 typedef NSUInteger NSWindowButton;
143 enum CWChannelBand {
144 kCWChannelBandUnknown = 0,
145 kCWChannelBand2GHz = 1,
146 kCWChannelBand5GHz = 2,
149 enum {
150 kCWSecurityNone = 0,
151 kCWSecurityWEP = 1,
152 kCWSecurityWPAPersonal = 2,
153 kCWSecurityWPAPersonalMixed = 3,
154 kCWSecurityWPA2Personal = 4,
155 kCWSecurityPersonal = 5,
156 kCWSecurityDynamicWEP = 6,
157 kCWSecurityWPAEnterprise = 7,
158 kCWSecurityWPAEnterpriseMixed = 8,
159 kCWSecurityWPA2Enterprise = 9,
160 kCWSecurityEnterprise = 10,
161 kCWSecurityUnknown = NSIntegerMax,
164 typedef NSInteger CWSecurity;
166 enum {
167 kBluetoothFeatureLESupportedController = (1 << 6L),
170 @protocol IOBluetoothDeviceInquiryDelegate
171 - (void)deviceInquiryStarted:(IOBluetoothDeviceInquiry*)sender;
172 - (void)deviceInquiryDeviceFound:(IOBluetoothDeviceInquiry*)sender
173 device:(IOBluetoothDevice*)device;
174 - (void)deviceInquiryComplete:(IOBluetoothDeviceInquiry*)sender
175 error:(IOReturn)error
176 aborted:(BOOL)aborted;
177 @end
179 enum {
180 CBPeripheralStateDisconnected = 0,
181 CBPeripheralStateConnecting,
182 CBPeripheralStateConnected,
184 typedef NSInteger CBPeripheralState;
186 enum {
187 CBCentralManagerStateUnknown = 0,
188 CBCentralManagerStateResetting,
189 CBCentralManagerStateUnsupported,
190 CBCentralManagerStateUnauthorized,
191 CBCentralManagerStatePoweredOff,
192 CBCentralManagerStatePoweredOn,
194 typedef NSInteger CBCentralManagerState;
196 @protocol CBCentralManagerDelegate;
198 @protocol CBCentralManagerDelegate<NSObject>
199 - (void)centralManagerDidUpdateState:(CBCentralManager*)central;
200 - (void)centralManager:(CBCentralManager*)central
201 didDiscoverPeripheral:(CBPeripheral*)peripheral
202 advertisementData:(NSDictionary*)advertisementData
203 RSSI:(NSNumber*)RSSI;
204 @end
206 #endif // MAC_OS_X_VERSION_10_7
208 #if !defined(MAC_OS_X_VERSION_10_8) || \
209 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
211 enum { NSEventPhaseMayBegin = 0x1 << 5 };
213 #endif // MAC_OS_X_VERSION_10_8
215 #if !defined(MAC_OS_X_VERSION_10_9) || \
216 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
218 enum {
219 NSWindowOcclusionStateVisible = 1UL << 1,
221 typedef NSUInteger NSWindowOcclusionState;
223 enum { NSWorkspaceLaunchWithErrorPresentation = 0x00000040 };
225 #endif // MAC_OS_X_VERSION_10_9
227 // ----------------------------------------------------------------------------
228 // Define NSStrings only available in newer versions of the OSX SDK to force
229 // them to be statically linked.
230 // ----------------------------------------------------------------------------
232 extern "C" {
233 #if !defined(MAC_OS_X_VERSION_10_7) || \
234 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
235 BASE_EXPORT extern NSString* const NSWindowWillEnterFullScreenNotification;
236 BASE_EXPORT extern NSString* const NSWindowWillExitFullScreenNotification;
237 BASE_EXPORT extern NSString* const NSWindowDidEnterFullScreenNotification;
238 BASE_EXPORT extern NSString* const NSWindowDidExitFullScreenNotification;
239 BASE_EXPORT extern NSString* const
240 NSWindowDidChangeBackingPropertiesNotification;
241 BASE_EXPORT extern NSString* const CBAdvertisementDataServiceDataKey;
242 BASE_EXPORT extern NSString* const
243 NSPreferredScrollerStyleDidChangeNotification;
244 #endif // MAC_OS_X_VERSION_10_7
246 #if !defined(MAC_OS_X_VERSION_10_9) || \
247 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
248 BASE_EXPORT extern NSString* const NSWindowDidChangeOcclusionStateNotification;
249 BASE_EXPORT extern NSString* const CBAdvertisementDataIsConnectable;
250 #endif // MAC_OS_X_VERSION_10_9
252 #if !defined(MAC_OS_X_VERSION_10_10) || \
253 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
254 BASE_EXPORT extern NSString* const NSUserActivityTypeBrowsingWeb;
255 BASE_EXPORT extern NSString* const NSAppearanceNameVibrantDark;
256 #endif // MAC_OS_X_VERSION_10_10
257 } // extern "C"
259 // ----------------------------------------------------------------------------
260 // If compiling against an older version of the OSX SDK, declare functions that
261 // are available in newer versions of the OSX SDK. If compiling against a newer
262 // version of the OSX SDK, redeclare those same functions to suppress
263 // -Wpartial-availability warnings.
264 // ----------------------------------------------------------------------------
266 // Once Chrome no longer supports OSX 10.6, everything within this preprocessor
267 // block can be removed.
268 #if !defined(MAC_OS_X_VERSION_10_7) || \
269 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
271 @interface NSEvent (LionSDK)
272 + (BOOL)isSwipeTrackingFromScrollEventsEnabled;
273 - (NSEventPhase)momentumPhase;
274 - (NSEventPhase)phase;
275 - (BOOL)hasPreciseScrollingDeltas;
276 - (CGFloat)scrollingDeltaX;
277 - (CGFloat)scrollingDeltaY;
278 - (void)trackSwipeEventWithOptions:(NSEventSwipeTrackingOptions)options
279 dampenAmountThresholdMin:(CGFloat)minDampenThreshold
280 max:(CGFloat)maxDampenThreshold
281 usingHandler:(void (^)(CGFloat gestureAmount,
282 NSEventPhase phase,
283 BOOL isComplete,
284 BOOL* stop))trackingHandler;
285 - (BOOL)isDirectionInvertedFromDevice;
286 @end
288 @interface NSApplication (LionSDK)
289 - (void)disableRelaunchOnLogin;
290 @end
292 @interface CALayer (LionSDK)
293 - (CGFloat)contentsScale;
294 - (void)setContentsScale:(CGFloat)contentsScale;
295 @end
297 @interface NSScreen (LionSDK)
298 - (CGFloat)backingScaleFactor;
299 - (NSRect)convertRectToBacking:(NSRect)aRect;
300 @end
302 @interface NSWindow (LionSDK)
303 - (CGFloat)backingScaleFactor;
304 - (NSWindowAnimationBehavior)animationBehavior;
305 - (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior;
306 - (void)toggleFullScreen:(id)sender;
307 - (void)setRestorable:(BOOL)flag;
308 - (NSRect)convertRectFromScreen:(NSRect)aRect;
309 @end
311 @interface NSCursor (LionSDKDeclarations)
312 + (NSCursor*)IBeamCursorForVerticalLayout;
313 @end
315 @interface NSAnimationContext (LionSDK)
316 + (void)runAnimationGroup:(void (^)(NSAnimationContext* context))changes
317 completionHandler:(void (^)(void))completionHandler;
318 @property(copy) void (^completionHandler)(void);
319 @end
321 @interface NSView (LionSDK)
322 - (NSSize)convertSizeFromBacking:(NSSize)size;
323 - (void)setWantsBestResolutionOpenGLSurface:(BOOL)flag;
324 @end
326 @interface NSObject (ICCameraDeviceDelegateLionSDK)
327 - (void)deviceDidBecomeReadyWithCompleteContentCatalog:(ICDevice*)device;
328 - (void)didDownloadFile:(ICCameraFile*)file
329 error:(NSError*)error
330 options:(NSDictionary*)options
331 contextInfo:(void*)contextInfo;
332 @end
334 @interface NSScroller (LionSDK)
335 + (NSInteger)preferredScrollerStyle;
336 @end
338 @interface CWInterface (LionSDK)
339 - (BOOL)associateToNetwork:(CWNetwork*)network
340 password:(NSString*)password
341 error:(NSError**)error;
342 - (NSSet*)scanForNetworksWithName:(NSString*)networkName error:(NSError**)error;
343 @end
345 @interface CWChannel (LionSDK)
346 @property(readonly) CWChannelBand channelBand;
347 @end
349 @interface CWNetwork (LionSDK)
350 @property(readonly) CWChannel* wlanChannel;
351 @property(readonly) NSInteger rssiValue;
352 - (BOOL)supportsSecurity:(CWSecurity)security;
353 @end
355 @interface IOBluetoothHostController (LionSDK)
356 - (NSString*)nameAsString;
357 - (BluetoothHCIPowerState)powerState;
358 @end
360 @interface IOBluetoothL2CAPChannel (LionSDK)
361 @property(readonly) BluetoothL2CAPMTU outgoingMTU;
362 @end
364 @interface IOBluetoothDevice (LionSDK)
365 - (NSString*)addressString;
366 - (unsigned int)classOfDevice;
367 - (BluetoothConnectionHandle)connectionHandle;
368 - (BluetoothHCIRSSIValue)rawRSSI;
369 - (NSArray*)services;
370 - (IOReturn)performSDPQuery:(id)target uuids:(NSArray*)uuids;
371 @end
373 @interface CBPeripheral (LionSDK)
374 @property(readonly, nonatomic) CFUUIDRef UUID;
375 @property(retain, readonly) NSString* name;
376 @property(readonly) BOOL isConnected;
377 @end
379 @interface CBCentralManager (LionSDK)
380 @property(readonly) CBCentralManagerState state;
381 - (id)initWithDelegate:(id<CBCentralManagerDelegate>)delegate
382 queue:(dispatch_queue_t)queue;
383 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs
384 options:(NSDictionary*)options;
385 - (void)stopScan;
386 @end
388 @interface CBUUID (LionSDK)
389 @property(nonatomic, readonly) NSData* data;
390 + (CBUUID*)UUIDWithString:(NSString*)theString;
391 @end
393 #endif // MAC_OS_X_VERSION_10_7
395 // Once Chrome no longer supports OSX 10.7, everything within this preprocessor
396 // block can be removed.
397 #if !defined(MAC_OS_X_VERSION_10_8) || \
398 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
400 @interface NSColor (MountainLionSDK)
401 - (CGColorRef)CGColor;
402 @end
404 @interface NSUUID (MountainLionSDK)
405 - (NSString*)UUIDString;
406 @end
408 @interface NSControl (MountainLionSDK)
409 @property BOOL allowsExpansionToolTips;
410 @end
412 #endif // MAC_OS_X_VERSION_10_8
414 // Once Chrome no longer supports OSX 10.8, everything within this preprocessor
415 // block can be removed.
416 #if !defined(MAC_OS_X_VERSION_10_9) || \
417 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
419 @interface NSProgress (MavericksSDK)
421 - (instancetype)initWithParent:(NSProgress*)parentProgressOrNil
422 userInfo:(NSDictionary*)userInfoOrNil;
423 @property(copy) NSString* kind;
425 @property int64_t totalUnitCount;
426 @property int64_t completedUnitCount;
428 @property(getter=isCancellable) BOOL cancellable;
429 @property(getter=isPausable) BOOL pausable;
430 @property(readonly, getter=isCancelled) BOOL cancelled;
431 @property(readonly, getter=isPaused) BOOL paused;
432 @property(copy) void (^cancellationHandler)(void);
433 @property(copy) void (^pausingHandler)(void);
434 - (void)cancel;
435 - (void)pause;
437 - (void)setUserInfoObject:(id)objectOrNil forKey:(NSString*)key;
438 - (NSDictionary*)userInfo;
440 @property(readonly, getter=isIndeterminate) BOOL indeterminate;
441 @property(readonly) double fractionCompleted;
443 - (void)publish;
444 - (void)unpublish;
446 @end
448 @interface NSScreen (MavericksSDK)
449 + (BOOL)screensHaveSeparateSpaces;
450 @end
452 @interface NSView (MavericksSDK)
453 - (void)setCanDrawSubviewsIntoLayer:(BOOL)flag;
454 - (NSAppearance*)effectiveAppearance;
455 @end
457 @interface NSWindow (MavericksSDK)
458 - (NSWindowOcclusionState)occlusionState;
459 @end
461 @interface NSAppearance (MavericksSDK)
462 + (id<NSObject>)appearanceNamed:(NSString*)name;
463 @end
465 @interface CBPeripheral (MavericksSDK)
466 @property(readonly, nonatomic) NSUUID* identifier;
467 @end
469 #endif // MAC_OS_X_VERSION_10_9
471 // Once Chrome no longer supports OSX 10.9, everything within this preprocessor
472 // block can be removed.
473 #if !defined(MAC_OS_X_VERSION_10_10) || \
474 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
476 @interface NSUserActivity (YosemiteSDK)
478 @property(readonly, copy) NSString* activityType;
479 @property(copy) NSDictionary* userInfo;
480 @property(copy) NSURL* webpageURL;
482 - (instancetype)initWithActivityType:(NSString*)activityType;
483 - (void)becomeCurrent;
484 - (void)invalidate;
486 @end
488 @interface CBUUID (YosemiteSDK)
489 - (NSString*)UUIDString;
490 @end
492 #endif // MAC_OS_X_VERSION_10_10
494 // ----------------------------------------------------------------------------
495 // Chrome uses -[CWNetwork securityMode] and -[CWNetwork rssi] on OSX 10.6. The
496 // former method relies on the enum CWSecurityMode which was removed in the OSX
497 // 10.9 SDK. In order for Chrome to compile against an OSX 10.9+ SDK, Chrome
498 // must define this enum. Chrome must also declare these methods.
500 // These declarations and definitions will not be necessary once Chrome no
501 // longer runs on OSX 10.6.
502 // ----------------------------------------------------------------------------
503 #if defined(MAC_OS_X_VERSION_10_9) && \
504 MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_6
505 typedef enum {
506 kCWSecurityModeOpen = 0,
507 kCWSecurityModeWEP,
508 kCWSecurityModeWPA_PSK,
509 kCWSecurityModeWPA2_PSK,
510 kCWSecurityModeWPA_Enterprise,
511 kCWSecurityModeWPA2_Enterprise,
512 kCWSecurityModeWPS,
513 kCWSecurityModeDynamicWEP
514 } CWSecurityMode;
516 @interface CWNetwork (SnowLeopardSDK)
517 @property(readonly) NSNumber* rssi;
518 @property(readonly) NSNumber* securityMode;
519 @end
520 #endif
522 // ----------------------------------------------------------------------------
523 // The symbol for kCWSSIDDidChangeNotification is available in the
524 // CoreWLAN.framework for OSX versions 10.6 through 10.10. The symbol is not
525 // declared in the OSX 10.9+ SDK, so when compiling against an OSX 10.9+ SDK,
526 // declare the symbol.
527 // ----------------------------------------------------------------------------
528 #if defined(MAC_OS_X_VERSION_10_9) && \
529 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
530 BASE_EXPORT extern "C" NSString* const kCWSSIDDidChangeNotification;
531 #endif
532 #endif // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_