forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sdk_forward_declarations.h
532 lines (421 loc) · 15.7 KB
/
sdk_forward_declarations.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file contains forward declarations for items in later SDKs than the
// default one with which Chromium is built (currently 10.6).
// If you call any function from this header, be sure to check at runtime for
// respondsToSelector: before calling these functions (else your code will crash
// on older OS X versions that chrome still supports).
#ifndef BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
#define BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
#import <AppKit/AppKit.h>
#import <CoreWLAN/CoreWLAN.h>
#import <ImageCaptureCore/ImageCaptureCore.h>
#import <IOBluetooth/IOBluetooth.h>
#include "base/base_export.h"
// ----------------------------------------------------------------------------
// Either define or forward declare classes only available in OSX 10.7+.
// ----------------------------------------------------------------------------
#if !defined(MAC_OS_X_VERSION_10_7) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
@interface CWChannel : NSObject
@end
@interface CBPeripheral : NSObject
@end
@interface CBCentralManager : NSObject
@end
@interface CBUUID : NSObject
@end
#else
@class CWChannel;
@class CBPeripheral;
@class CBCentralManager;
@class CBUUID;
#endif // MAC_OS_X_VERSION_10_7
#if !defined(MAC_OS_X_VERSION_10_8) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
@interface NSUUID : NSObject
@end
#else
@class NSUUID;
#endif // MAC_OS_X_VERSION_10_8
#if !defined(MAC_OS_X_VERSION_10_9) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
// NSProgress is public API in 10.9, but a version of it exists and is usable
// in 10.8.
@interface NSProgress : NSObject
@end
@interface NSAppearance : NSObject
@end
#else
@class NSProgress;
@class NSAppearance;
#endif // MAC_OS_X_VERSION_10_9
#if !defined(MAC_OS_X_VERSION_10_10) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
@interface NSUserActivity : NSObject
@end
#else
@class NSUserActivity;
#endif // MAC_OS_X_VERSION_10_10
// ----------------------------------------------------------------------------
// Define typedefs, enums, and protocols not available in the version of the
// OSX SDK being compiled against.
// ----------------------------------------------------------------------------
#if !defined(MAC_OS_X_VERSION_10_7) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
enum {
NSEventPhaseNone = 0, // event not associated with a phase.
NSEventPhaseBegan = 0x1 << 0,
NSEventPhaseStationary = 0x1 << 1,
NSEventPhaseChanged = 0x1 << 2,
NSEventPhaseEnded = 0x1 << 3,
NSEventPhaseCancelled = 0x1 << 4
};
typedef NSUInteger NSEventPhase;
enum {
NSFullScreenWindowMask = 1 << 14,
};
enum {
NSApplicationPresentationFullScreen = 1 << 10,
};
enum {
NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8,
};
enum {
NSEventSwipeTrackingLockDirection = 0x1 << 0,
NSEventSwipeTrackingClampGestureAmount = 0x1 << 1,
};
typedef NSUInteger NSEventSwipeTrackingOptions;
enum {
NSWindowAnimationBehaviorDefault = 0,
NSWindowAnimationBehaviorNone = 2,
NSWindowAnimationBehaviorDocumentWindow = 3,
NSWindowAnimationBehaviorUtilityWindow = 4,
NSWindowAnimationBehaviorAlertPanel = 5
};
typedef NSInteger NSWindowAnimationBehavior;
enum {
NSWindowDocumentVersionsButton = 6,
NSWindowFullScreenButton,
};
typedef NSUInteger NSWindowButton;
enum CWChannelBand {
kCWChannelBandUnknown = 0,
kCWChannelBand2GHz = 1,
kCWChannelBand5GHz = 2,
};
enum {
kCWSecurityNone = 0,
kCWSecurityWEP = 1,
kCWSecurityWPAPersonal = 2,
kCWSecurityWPAPersonalMixed = 3,
kCWSecurityWPA2Personal = 4,
kCWSecurityPersonal = 5,
kCWSecurityDynamicWEP = 6,
kCWSecurityWPAEnterprise = 7,
kCWSecurityWPAEnterpriseMixed = 8,
kCWSecurityWPA2Enterprise = 9,
kCWSecurityEnterprise = 10,
kCWSecurityUnknown = NSIntegerMax,
};
typedef NSInteger CWSecurity;
enum {
kBluetoothFeatureLESupportedController = (1 << 6L),
};
@protocol IOBluetoothDeviceInquiryDelegate
- (void)deviceInquiryStarted:(IOBluetoothDeviceInquiry*)sender;
- (void)deviceInquiryDeviceFound:(IOBluetoothDeviceInquiry*)sender
device:(IOBluetoothDevice*)device;
- (void)deviceInquiryComplete:(IOBluetoothDeviceInquiry*)sender
error:(IOReturn)error
aborted:(BOOL)aborted;
@end
enum {
CBPeripheralStateDisconnected = 0,
CBPeripheralStateConnecting,
CBPeripheralStateConnected,
};
typedef NSInteger CBPeripheralState;
enum {
CBCentralManagerStateUnknown = 0,
CBCentralManagerStateResetting,
CBCentralManagerStateUnsupported,
CBCentralManagerStateUnauthorized,
CBCentralManagerStatePoweredOff,
CBCentralManagerStatePoweredOn,
};
typedef NSInteger CBCentralManagerState;
@protocol CBCentralManagerDelegate;
@protocol CBCentralManagerDelegate<NSObject>
- (void)centralManagerDidUpdateState:(CBCentralManager*)central;
- (void)centralManager:(CBCentralManager*)central
didDiscoverPeripheral:(CBPeripheral*)peripheral
advertisementData:(NSDictionary*)advertisementData
RSSI:(NSNumber*)RSSI;
@end
#endif // MAC_OS_X_VERSION_10_7
#if !defined(MAC_OS_X_VERSION_10_8) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
enum { NSEventPhaseMayBegin = 0x1 << 5 };
#endif // MAC_OS_X_VERSION_10_8
#if !defined(MAC_OS_X_VERSION_10_9) || \
MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
enum {
NSWindowOcclusionStateVisible = 1UL << 1,
};
typedef NSUInteger NSWindowOcclusionState;
enum { NSWorkspaceLaunchWithErrorPresentation = 0x00000040 };
#endif // MAC_OS_X_VERSION_10_9
// ----------------------------------------------------------------------------
// Define NSStrings only available in newer versions of the OSX SDK to force
// them to be statically linked.
// ----------------------------------------------------------------------------
extern "C" {
#if !defined(MAC_OS_X_VERSION_10_7) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
BASE_EXPORT extern NSString* const NSWindowWillEnterFullScreenNotification;
BASE_EXPORT extern NSString* const NSWindowWillExitFullScreenNotification;
BASE_EXPORT extern NSString* const NSWindowDidEnterFullScreenNotification;
BASE_EXPORT extern NSString* const NSWindowDidExitFullScreenNotification;
BASE_EXPORT extern NSString* const
NSWindowDidChangeBackingPropertiesNotification;
BASE_EXPORT extern NSString* const CBAdvertisementDataServiceDataKey;
BASE_EXPORT extern NSString* const
NSPreferredScrollerStyleDidChangeNotification;
#endif // MAC_OS_X_VERSION_10_7
#if !defined(MAC_OS_X_VERSION_10_9) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
BASE_EXPORT extern NSString* const NSWindowDidChangeOcclusionStateNotification;
BASE_EXPORT extern NSString* const CBAdvertisementDataIsConnectable;
#endif // MAC_OS_X_VERSION_10_9
#if !defined(MAC_OS_X_VERSION_10_10) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
BASE_EXPORT extern NSString* const NSUserActivityTypeBrowsingWeb;
BASE_EXPORT extern NSString* const NSAppearanceNameVibrantDark;
#endif // MAC_OS_X_VERSION_10_10
} // extern "C"
// ----------------------------------------------------------------------------
// If compiling against an older version of the OSX SDK, declare functions that
// are available in newer versions of the OSX SDK. If compiling against a newer
// version of the OSX SDK, redeclare those same functions to suppress
// -Wpartial-availability warnings.
// ----------------------------------------------------------------------------
// Once Chrome no longer supports OSX 10.6, everything within this preprocessor
// block can be removed.
#if !defined(MAC_OS_X_VERSION_10_7) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
@interface NSEvent (LionSDK)
+ (BOOL)isSwipeTrackingFromScrollEventsEnabled;
- (NSEventPhase)momentumPhase;
- (NSEventPhase)phase;
- (BOOL)hasPreciseScrollingDeltas;
- (CGFloat)scrollingDeltaX;
- (CGFloat)scrollingDeltaY;
- (void)trackSwipeEventWithOptions:(NSEventSwipeTrackingOptions)options
dampenAmountThresholdMin:(CGFloat)minDampenThreshold
max:(CGFloat)maxDampenThreshold
usingHandler:(void (^)(CGFloat gestureAmount,
NSEventPhase phase,
BOOL isComplete,
BOOL* stop))trackingHandler;
- (BOOL)isDirectionInvertedFromDevice;
@end
@interface NSApplication (LionSDK)
- (void)disableRelaunchOnLogin;
@end
@interface CALayer (LionSDK)
- (CGFloat)contentsScale;
- (void)setContentsScale:(CGFloat)contentsScale;
@end
@interface NSScreen (LionSDK)
- (CGFloat)backingScaleFactor;
- (NSRect)convertRectToBacking:(NSRect)aRect;
@end
@interface NSWindow (LionSDK)
- (CGFloat)backingScaleFactor;
- (NSWindowAnimationBehavior)animationBehavior;
- (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior;
- (void)toggleFullScreen:(id)sender;
- (void)setRestorable:(BOOL)flag;
- (NSRect)convertRectFromScreen:(NSRect)aRect;
@end
@interface NSCursor (LionSDKDeclarations)
+ (NSCursor*)IBeamCursorForVerticalLayout;
@end
@interface NSAnimationContext (LionSDK)
+ (void)runAnimationGroup:(void (^)(NSAnimationContext* context))changes
completionHandler:(void (^)(void))completionHandler;
@property(copy) void (^completionHandler)(void);
@end
@interface NSView (LionSDK)
- (NSSize)convertSizeFromBacking:(NSSize)size;
- (void)setWantsBestResolutionOpenGLSurface:(BOOL)flag;
@end
@interface NSObject (ICCameraDeviceDelegateLionSDK)
- (void)deviceDidBecomeReadyWithCompleteContentCatalog:(ICDevice*)device;
- (void)didDownloadFile:(ICCameraFile*)file
error:(NSError*)error
options:(NSDictionary*)options
contextInfo:(void*)contextInfo;
@end
@interface NSScroller (LionSDK)
+ (NSInteger)preferredScrollerStyle;
@end
@interface CWInterface (LionSDK)
- (BOOL)associateToNetwork:(CWNetwork*)network
password:(NSString*)password
error:(NSError**)error;
- (NSSet*)scanForNetworksWithName:(NSString*)networkName error:(NSError**)error;
@end
@interface CWChannel (LionSDK)
@property(readonly) CWChannelBand channelBand;
@end
@interface CWNetwork (LionSDK)
@property(readonly) CWChannel* wlanChannel;
@property(readonly) NSInteger rssiValue;
- (BOOL)supportsSecurity:(CWSecurity)security;
@end
@interface IOBluetoothHostController (LionSDK)
- (NSString*)nameAsString;
- (BluetoothHCIPowerState)powerState;
@end
@interface IOBluetoothL2CAPChannel (LionSDK)
@property(readonly) BluetoothL2CAPMTU outgoingMTU;
@end
@interface IOBluetoothDevice (LionSDK)
- (NSString*)addressString;
- (unsigned int)classOfDevice;
- (BluetoothConnectionHandle)connectionHandle;
- (BluetoothHCIRSSIValue)rawRSSI;
- (NSArray*)services;
- (IOReturn)performSDPQuery:(id)target uuids:(NSArray*)uuids;
@end
@interface CBPeripheral (LionSDK)
@property(readonly, nonatomic) CFUUIDRef UUID;
@property(retain, readonly) NSString* name;
@property(readonly) BOOL isConnected;
@end
@interface CBCentralManager (LionSDK)
@property(readonly) CBCentralManagerState state;
- (id)initWithDelegate:(id<CBCentralManagerDelegate>)delegate
queue:(dispatch_queue_t)queue;
- (void)scanForPeripheralsWithServices:(NSArray*)serviceUUIDs
options:(NSDictionary*)options;
- (void)stopScan;
@end
@interface CBUUID (LionSDK)
@property(nonatomic, readonly) NSData* data;
+ (CBUUID*)UUIDWithString:(NSString*)theString;
@end
#endif // MAC_OS_X_VERSION_10_7
// Once Chrome no longer supports OSX 10.7, everything within this preprocessor
// block can be removed.
#if !defined(MAC_OS_X_VERSION_10_8) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_8
@interface NSColor (MountainLionSDK)
- (CGColorRef)CGColor;
@end
@interface NSUUID (MountainLionSDK)
- (NSString*)UUIDString;
@end
@interface NSControl (MountainLionSDK)
@property BOOL allowsExpansionToolTips;
@end
#endif // MAC_OS_X_VERSION_10_8
// Once Chrome no longer supports OSX 10.8, everything within this preprocessor
// block can be removed.
#if !defined(MAC_OS_X_VERSION_10_9) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9
@interface NSProgress (MavericksSDK)
- (instancetype)initWithParent:(NSProgress*)parentProgressOrNil
userInfo:(NSDictionary*)userInfoOrNil;
@property(copy) NSString* kind;
@property int64_t totalUnitCount;
@property int64_t completedUnitCount;
@property(getter=isCancellable) BOOL cancellable;
@property(getter=isPausable) BOOL pausable;
@property(readonly, getter=isCancelled) BOOL cancelled;
@property(readonly, getter=isPaused) BOOL paused;
@property(copy) void (^cancellationHandler)(void);
@property(copy) void (^pausingHandler)(void);
- (void)cancel;
- (void)pause;
- (void)setUserInfoObject:(id)objectOrNil forKey:(NSString*)key;
- (NSDictionary*)userInfo;
@property(readonly, getter=isIndeterminate) BOOL indeterminate;
@property(readonly) double fractionCompleted;
- (void)publish;
- (void)unpublish;
@end
@interface NSScreen (MavericksSDK)
+ (BOOL)screensHaveSeparateSpaces;
@end
@interface NSView (MavericksSDK)
- (void)setCanDrawSubviewsIntoLayer:(BOOL)flag;
- (NSAppearance*)effectiveAppearance;
@end
@interface NSWindow (MavericksSDK)
- (NSWindowOcclusionState)occlusionState;
@end
@interface NSAppearance (MavericksSDK)
+ (id<NSObject>)appearanceNamed:(NSString*)name;
@end
@interface CBPeripheral (MavericksSDK)
@property(readonly, nonatomic) NSUUID* identifier;
@end
#endif // MAC_OS_X_VERSION_10_9
// Once Chrome no longer supports OSX 10.9, everything within this preprocessor
// block can be removed.
#if !defined(MAC_OS_X_VERSION_10_10) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
@interface NSUserActivity (YosemiteSDK)
@property(readonly, copy) NSString* activityType;
@property(copy) NSDictionary* userInfo;
@property(copy) NSURL* webpageURL;
- (instancetype)initWithActivityType:(NSString*)activityType;
- (void)becomeCurrent;
- (void)invalidate;
@end
@interface CBUUID (YosemiteSDK)
- (NSString*)UUIDString;
@end
#endif // MAC_OS_X_VERSION_10_10
// ----------------------------------------------------------------------------
// Chrome uses -[CWNetwork securityMode] and -[CWNetwork rssi] on OSX 10.6. The
// former method relies on the enum CWSecurityMode which was removed in the OSX
// 10.9 SDK. In order for Chrome to compile against an OSX 10.9+ SDK, Chrome
// must define this enum. Chrome must also declare these methods.
//
// These declarations and definitions will not be necessary once Chrome no
// longer runs on OSX 10.6.
// ----------------------------------------------------------------------------
#if defined(MAC_OS_X_VERSION_10_9) && \
MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_6
typedef enum {
kCWSecurityModeOpen = 0,
kCWSecurityModeWEP,
kCWSecurityModeWPA_PSK,
kCWSecurityModeWPA2_PSK,
kCWSecurityModeWPA_Enterprise,
kCWSecurityModeWPA2_Enterprise,
kCWSecurityModeWPS,
kCWSecurityModeDynamicWEP
} CWSecurityMode;
@interface CWNetwork (SnowLeopardSDK)
@property(readonly) NSNumber* rssi;
@property(readonly) NSNumber* securityMode;
@end
#endif
// ----------------------------------------------------------------------------
// The symbol for kCWSSIDDidChangeNotification is available in the
// CoreWLAN.framework for OSX versions 10.6 through 10.10. The symbol is not
// declared in the OSX 10.9+ SDK, so when compiling against an OSX 10.9+ SDK,
// declare the symbol.
// ----------------------------------------------------------------------------
#if defined(MAC_OS_X_VERSION_10_9) && \
MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_9
BASE_EXPORT extern "C" NSString* const kCWSSIDDidChangeNotification;
#endif
#endif // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_