Add ICU message format support
[chromium-blink-merge.git] / base / mac / sdk_forward_declarations.h
blob1b12061e3025f70695175c1f294064602da5f4a0
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 CBAdvertisementDataServiceUUIDsKey;
243 BASE_EXPORT extern NSString* const
244 NSPreferredScrollerStyleDidChangeNotification;
245 #endif // MAC_OS_X_VERSION_10_7
247 #if !defined(MAC_OS_X_VERSION_10_9) || \
248 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
249 BASE_EXPORT extern NSString* const NSWindowDidChangeOcclusionStateNotification;
250 BASE_EXPORT extern NSString* const CBAdvertisementDataOverflowServiceUUIDsKey;
251 BASE_EXPORT extern NSString* const CBAdvertisementDataIsConnectable;
252 #endif // MAC_OS_X_VERSION_10_9
254 #if !defined(MAC_OS_X_VERSION_10_10) || \
255 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
256 BASE_EXPORT extern NSString* const NSUserActivityTypeBrowsingWeb;
257 BASE_EXPORT extern NSString* const NSAppearanceNameVibrantDark;
258 #endif // MAC_OS_X_VERSION_10_10
259 } // extern "C"
261 // ----------------------------------------------------------------------------
262 // If compiling against an older version of the OSX SDK, declare functions that
263 // are available in newer versions of the OSX SDK. If compiling against a newer
264 // version of the OSX SDK, redeclare those same functions to suppress
265 // -Wpartial-availability warnings.
266 // ----------------------------------------------------------------------------
268 // Once Chrome no longer supports OSX 10.6, everything within this preprocessor
269 // block can be removed.
270 #if !defined(MAC_OS_X_VERSION_10_7) || \
271 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
273 @interface NSEvent (LionSDK)
274 + (BOOL)isSwipeTrackingFromScrollEventsEnabled;
275 - (NSEventPhase)momentumPhase;
276 - (NSEventPhase)phase;
277 - (BOOL)hasPreciseScrollingDeltas;
278 - (CGFloat)scrollingDeltaX;
279 - (CGFloat)scrollingDeltaY;
280 - (void)trackSwipeEventWithOptions:(NSEventSwipeTrackingOptions)options
281 dampenAmountThresholdMin:(CGFloat)minDampenThreshold
282 max:(CGFloat)maxDampenThreshold
283 usingHandler:(void (^)(CGFloat gestureAmount,
284 NSEventPhase phase,
285 BOOL isComplete,
286 BOOL* stop))trackingHandler;
287 - (BOOL)isDirectionInvertedFromDevice;
288 @end
290 @interface NSApplication (LionSDK)
291 - (void)disableRelaunchOnLogin;
292 @end
294 @interface CALayer (LionSDK)
295 - (CGFloat)contentsScale;
296 - (void)setContentsScale:(CGFloat)contentsScale;
297 @end
299 @interface NSScreen (LionSDK)
300 - (CGFloat)backingScaleFactor;
301 - (NSRect)convertRectToBacking:(NSRect)aRect;
302 @end
304 @interface NSWindow (LionSDK)
305 - (CGFloat)backingScaleFactor;
306 - (NSWindowAnimationBehavior)animationBehavior;
307 - (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior;
308 - (void)toggleFullScreen:(id)sender;
309 - (void)setRestorable:(BOOL)flag;
310 - (NSRect)convertRectFromScreen:(NSRect)aRect;
311 @end
313 @interface NSCursor (LionSDKDeclarations)
314 + (NSCursor*)IBeamCursorForVerticalLayout;
315 @end
317 @interface NSAnimationContext (LionSDK)
318 + (void)runAnimationGroup:(void (^)(NSAnimationContext* context))changes
319 completionHandler:(void (^)(void))completionHandler;
320 @property(copy) void (^completionHandler)(void);
321 @end
323 @interface NSView (LionSDK)
324 - (NSSize)convertSizeFromBacking:(NSSize)size;
325 - (void)setWantsBestResolutionOpenGLSurface:(BOOL)flag;
326 @end
328 @interface NSObject (ICCameraDeviceDelegateLionSDK)
329 - (void)deviceDidBecomeReadyWithCompleteContentCatalog:(ICDevice*)device;
330 - (void)didDownloadFile:(ICCameraFile*)file
331 error:(NSError*)error
332 options:(NSDictionary*)options
333 contextInfo:(void*)contextInfo;
334 @end
336 @interface NSScroller (LionSDK)
337 + (NSInteger)preferredScrollerStyle;
338 @end
340 @interface CWInterface (LionSDK)
341 - (BOOL)associateToNetwork:(CWNetwork*)network
342 password:(NSString*)password
343 error:(NSError**)error;
344 - (NSSet*)scanForNetworksWithName:(NSString*)networkName error:(NSError**)error;
345 @end
347 @interface CWChannel (LionSDK)
348 @property(readonly) CWChannelBand channelBand;
349 @end
351 @interface CWNetwork (LionSDK)
352 @property(readonly) CWChannel* wlanChannel;
353 @property(readonly) NSInteger rssiValue;
354 - (BOOL)supportsSecurity:(CWSecurity)security;
355 @end
357 @interface IOBluetoothHostController (LionSDK)
358 - (NSString*)nameAsString;
359 - (BluetoothHCIPowerState)powerState;
360 @end
362 @interface IOBluetoothL2CAPChannel (LionSDK)
363 @property(readonly) BluetoothL2CAPMTU outgoingMTU;
364 @end
366 @interface IOBluetoothDevice (LionSDK)
367 - (NSString*)addressString;
368 - (unsigned int)classOfDevice;
369 - (BluetoothConnectionHandle)connectionHandle;
370 - (BluetoothHCIRSSIValue)rawRSSI;
371 - (NSArray*)services;
372 - (IOReturn)performSDPQuery:(id)target uuids:(NSArray*)uuids;
373 @end
375 @interface CBPeripheral (LionSDK)
376 @property(readonly, nonatomic) CFUUIDRef UUID;
377 @property(retain, readonly) NSString* name;
378 @property(readonly) BOOL isConnected;
379 @end
381 @interface CBCentralManager (LionSDK)
382 @property(readonly) CBCentralManagerState state;
383 - (id)initWithDelegate:(id<CBCentralManagerDelegate>)delegate
384 queue:(dispatch_queue_t)queue;
385 - (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs
386 options:(NSDictionary*)options;
387 - (void)stopScan;
388 @end
390 @interface CBUUID (LionSDK)
391 @property(nonatomic, readonly) NSData* data;
392 + (CBUUID*)UUIDWithString:(NSString*)theString;
393 @end
395 #endif // MAC_OS_X_VERSION_10_7
397 // Once Chrome no longer supports OSX 10.7, everything within this preprocessor
398 // block can be removed.
399 #if !defined(MAC_OS_X_VERSION_10_8) || \
400 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
402 @interface NSColor (MountainLionSDK)
403 - (CGColorRef)CGColor;
404 @end
406 @interface NSUUID (MountainLionSDK)
407 - (NSString*)UUIDString;
408 @end
410 @interface NSControl (MountainLionSDK)
411 @property BOOL allowsExpansionToolTips;
412 @end
414 #endif // MAC_OS_X_VERSION_10_8
416 // Once Chrome no longer supports OSX 10.8, everything within this preprocessor
417 // block can be removed.
418 #if !defined(MAC_OS_X_VERSION_10_9) || \
419 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
421 @interface NSProgress (MavericksSDK)
423 - (instancetype)initWithParent:(NSProgress*)parentProgressOrNil
424 userInfo:(NSDictionary*)userInfoOrNil;
425 @property(copy) NSString* kind;
427 @property int64_t totalUnitCount;
428 @property int64_t completedUnitCount;
430 @property(getter=isCancellable) BOOL cancellable;
431 @property(getter=isPausable) BOOL pausable;
432 @property(readonly, getter=isCancelled) BOOL cancelled;
433 @property(readonly, getter=isPaused) BOOL paused;
434 @property(copy) void (^cancellationHandler)(void);
435 @property(copy) void (^pausingHandler)(void);
436 - (void)cancel;
437 - (void)pause;
439 - (void)setUserInfoObject:(id)objectOrNil forKey:(NSString*)key;
440 - (NSDictionary*)userInfo;
442 @property(readonly, getter=isIndeterminate) BOOL indeterminate;
443 @property(readonly) double fractionCompleted;
445 - (void)publish;
446 - (void)unpublish;
448 @end
450 @interface NSScreen (MavericksSDK)
451 + (BOOL)screensHaveSeparateSpaces;
452 @end
454 @interface NSView (MavericksSDK)
455 - (void)setCanDrawSubviewsIntoLayer:(BOOL)flag;
456 - (NSAppearance*)effectiveAppearance;
457 @end
459 @interface NSWindow (MavericksSDK)
460 - (NSWindowOcclusionState)occlusionState;
461 @end
463 @interface NSAppearance (MavericksSDK)
464 + (id<NSObject>)appearanceNamed:(NSString*)name;
465 @end
467 @interface CBPeripheral (MavericksSDK)
468 @property(readonly, nonatomic) NSUUID* identifier;
469 @end
471 #endif // MAC_OS_X_VERSION_10_9
473 // Once Chrome no longer supports OSX 10.9, everything within this preprocessor
474 // block can be removed.
475 #if !defined(MAC_OS_X_VERSION_10_10) || \
476 MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
478 @interface NSUserActivity (YosemiteSDK)
480 @property(readonly, copy) NSString* activityType;
481 @property(copy) NSDictionary* userInfo;
482 @property(copy) NSURL* webpageURL;
484 - (instancetype)initWithActivityType:(NSString*)activityType;
485 - (void)becomeCurrent;
486 - (void)invalidate;
488 @end
490 @interface CBUUID (YosemiteSDK)
491 - (NSString*)UUIDString;
492 @end
494 #endif // MAC_OS_X_VERSION_10_10
496 // ----------------------------------------------------------------------------
497 // Chrome uses -[CWNetwork securityMode] and -[CWNetwork rssi] on OSX 10.6. The
498 // former method relies on the enum CWSecurityMode which was removed in the OSX
499 // 10.9 SDK. In order for Chrome to compile against an OSX 10.9+ SDK, Chrome
500 // must define this enum. Chrome must also declare these methods.
502 // These declarations and definitions will not be necessary once Chrome no
503 // longer runs on OSX 10.6.
504 // ----------------------------------------------------------------------------
505 #if defined(MAC_OS_X_VERSION_10_9) && \
506 MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_6
507 typedef enum {
508 kCWSecurityModeOpen = 0,
509 kCWSecurityModeWEP,
510 kCWSecurityModeWPA_PSK,
511 kCWSecurityModeWPA2_PSK,
512 kCWSecurityModeWPA_Enterprise,
513 kCWSecurityModeWPA2_Enterprise,
514 kCWSecurityModeWPS,
515 kCWSecurityModeDynamicWEP
516 } CWSecurityMode;
518 @interface CWNetwork (SnowLeopardSDK)
519 @property(readonly) NSNumber* rssi;
520 @property(readonly) NSNumber* securityMode;
521 @end
522 #endif
524 // ----------------------------------------------------------------------------
525 // The symbol for kCWSSIDDidChangeNotification is available in the
526 // CoreWLAN.framework for OSX versions 10.6 through 10.10. The symbol is not
527 // declared in the OSX 10.9+ SDK, so when compiling against an OSX 10.9+ SDK,
528 // declare the symbol.
529 // ----------------------------------------------------------------------------
530 #if defined(MAC_OS_X_VERSION_10_9) && \
531 MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
532 BASE_EXPORT extern "C" NSString* const kCWSSIDDidChangeNotification;
533 #endif
534 #endif // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_