Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Side by Side Diff: base/mac/sdk_forward_declarations.h

Issue 1647803004: Move base to DEPS (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/mac/scoped_typeref.h ('k') | base/mac/sdk_forward_declarations.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
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).
10
11 #ifndef BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
12 #define BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
13
14 #import <AppKit/AppKit.h>
15 #import <CoreWLAN/CoreWLAN.h>
16 #import <ImageCaptureCore/ImageCaptureCore.h>
17 #import <IOBluetooth/IOBluetooth.h>
18
19 #include "base/base_export.h"
20
21 // ----------------------------------------------------------------------------
22 // Either define or forward declare classes only available in OSX 10.7+.
23 // ----------------------------------------------------------------------------
24
25 #if !defined(MAC_OS_X_VERSION_10_7) || \
26 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
27
28 @interface CWChannel : NSObject
29 @end
30
31 @interface CBPeripheral : NSObject
32 @end
33
34 @interface CBCentralManager : NSObject
35 @end
36
37 @interface CBUUID : NSObject
38 @end
39
40 #else
41
42 @class CWChannel;
43 @class CBPeripheral;
44 @class CBCentralManager;
45 @class CBUUID;
46
47 #endif // MAC_OS_X_VERSION_10_7
48
49 #if !defined(MAC_OS_X_VERSION_10_8) || \
50 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
51
52 @interface NSUUID : NSObject
53 @end
54
55 #else
56
57 @class NSUUID;
58
59 #endif // MAC_OS_X_VERSION_10_8
60
61 #if !defined(MAC_OS_X_VERSION_10_9) || \
62 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
63
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
68
69 @interface NSAppearance : NSObject
70 @end
71
72 #else
73
74 @class NSProgress;
75 @class NSAppearance;
76
77 #endif // MAC_OS_X_VERSION_10_9
78
79 #if !defined(MAC_OS_X_VERSION_10_10) || \
80 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
81
82 @interface NSUserActivity : NSObject
83 @end
84
85 #else
86
87 @class NSUserActivity;
88
89 #endif // MAC_OS_X_VERSION_10_10
90
91 // ----------------------------------------------------------------------------
92 // Define typedefs, enums, and protocols not available in the version of the
93 // OSX SDK being compiled against.
94 // ----------------------------------------------------------------------------
95
96 #if !defined(MAC_OS_X_VERSION_10_7) || \
97 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
98
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
106 };
107 typedef NSUInteger NSEventPhase;
108
109 enum {
110 NSFullScreenWindowMask = 1 << 14,
111 };
112
113 enum {
114 NSApplicationPresentationFullScreen = 1 << 10,
115 };
116
117 enum {
118 NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
119 NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8,
120 };
121
122 enum {
123 NSEventSwipeTrackingLockDirection = 0x1 << 0,
124 NSEventSwipeTrackingClampGestureAmount = 0x1 << 1,
125 };
126 typedef NSUInteger NSEventSwipeTrackingOptions;
127
128 enum {
129 NSWindowAnimationBehaviorDefault = 0,
130 NSWindowAnimationBehaviorNone = 2,
131 NSWindowAnimationBehaviorDocumentWindow = 3,
132 NSWindowAnimationBehaviorUtilityWindow = 4,
133 NSWindowAnimationBehaviorAlertPanel = 5
134 };
135 typedef NSInteger NSWindowAnimationBehavior;
136
137 enum {
138 NSWindowDocumentVersionsButton = 6,
139 NSWindowFullScreenButton,
140 };
141 typedef NSUInteger NSWindowButton;
142
143 enum CWChannelBand {
144 kCWChannelBandUnknown = 0,
145 kCWChannelBand2GHz = 1,
146 kCWChannelBand5GHz = 2,
147 };
148
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,
162 };
163
164 typedef NSInteger CWSecurity;
165
166 enum {
167 kBluetoothFeatureLESupportedController = (1 << 6L),
168 };
169
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
178
179 enum {
180 CBPeripheralStateDisconnected = 0,
181 CBPeripheralStateConnecting,
182 CBPeripheralStateConnected,
183 };
184 typedef NSInteger CBPeripheralState;
185
186 enum {
187 CBCentralManagerStateUnknown = 0,
188 CBCentralManagerStateResetting,
189 CBCentralManagerStateUnsupported,
190 CBCentralManagerStateUnauthorized,
191 CBCentralManagerStatePoweredOff,
192 CBCentralManagerStatePoweredOn,
193 };
194 typedef NSInteger CBCentralManagerState;
195
196 @protocol CBCentralManagerDelegate;
197
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
205
206 #endif // MAC_OS_X_VERSION_10_7
207
208 #if !defined(MAC_OS_X_VERSION_10_8) || \
209 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
210
211 enum { NSEventPhaseMayBegin = 0x1 << 5 };
212
213 #endif // MAC_OS_X_VERSION_10_8
214
215 #if !defined(MAC_OS_X_VERSION_10_9) || \
216 MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
217
218 enum {
219 NSWindowOcclusionStateVisible = 1UL << 1,
220 };
221 typedef NSUInteger NSWindowOcclusionState;
222
223 enum { NSWorkspaceLaunchWithErrorPresentation = 0x00000040 };
224
225 #endif // MAC_OS_X_VERSION_10_9
226
227 // ----------------------------------------------------------------------------
228 // Define NSStrings only available in newer versions of the OSX SDK to force
229 // them to be statically linked.
230 // ----------------------------------------------------------------------------
231
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
245
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
251
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"
258
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 // ----------------------------------------------------------------------------
265
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
270
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
287
288 @interface NSApplication (LionSDK)
289 - (void)disableRelaunchOnLogin;
290 @end
291
292 @interface CALayer (LionSDK)
293 - (CGFloat)contentsScale;
294 - (void)setContentsScale:(CGFloat)contentsScale;
295 @end
296
297 @interface NSScreen (LionSDK)
298 - (CGFloat)backingScaleFactor;
299 - (NSRect)convertRectToBacking:(NSRect)aRect;
300 @end
301
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
310
311 @interface NSCursor (LionSDKDeclarations)
312 + (NSCursor*)IBeamCursorForVerticalLayout;
313 @end
314
315 @interface NSAnimationContext (LionSDK)
316 + (void)runAnimationGroup:(void (^)(NSAnimationContext* context))changes
317 completionHandler:(void (^)(void))completionHandler;
318 @property(copy) void (^completionHandler)(void);
319 @end
320
321 @interface NSView (LionSDK)
322 - (NSSize)convertSizeFromBacking:(NSSize)size;
323 - (void)setWantsBestResolutionOpenGLSurface:(BOOL)flag;
324 @end
325
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
333
334 @interface NSScroller (LionSDK)
335 + (NSInteger)preferredScrollerStyle;
336 @end
337
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
344
345 @interface CWChannel (LionSDK)
346 @property(readonly) CWChannelBand channelBand;
347 @end
348
349 @interface CWNetwork (LionSDK)
350 @property(readonly) CWChannel* wlanChannel;
351 @property(readonly) NSInteger rssiValue;
352 - (BOOL)supportsSecurity:(CWSecurity)security;
353 @end
354
355 @interface IOBluetoothHostController (LionSDK)
356 - (NSString*)nameAsString;
357 - (BluetoothHCIPowerState)powerState;
358 @end
359
360 @interface IOBluetoothL2CAPChannel (LionSDK)
361 @property(readonly) BluetoothL2CAPMTU outgoingMTU;
362 @end
363
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
372
373 @interface CBPeripheral (LionSDK)
374 @property(readonly, nonatomic) CFUUIDRef UUID;
375 @property(retain, readonly) NSString* name;
376 @property(readonly) BOOL isConnected;
377 @end
378
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
387
388 @interface CBUUID (LionSDK)
389 @property(nonatomic, readonly) NSData* data;
390 + (CBUUID*)UUIDWithString:(NSString*)theString;
391 @end
392
393 #endif // MAC_OS_X_VERSION_10_7
394
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
399
400 @interface NSColor (MountainLionSDK)
401 - (CGColorRef)CGColor;
402 @end
403
404 @interface NSUUID (MountainLionSDK)
405 - (NSString*)UUIDString;
406 @end
407
408 @interface NSControl (MountainLionSDK)
409 @property BOOL allowsExpansionToolTips;
410 @end
411
412 #endif // MAC_OS_X_VERSION_10_8
413
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
418
419 @interface NSProgress (MavericksSDK)
420
421 - (instancetype)initWithParent:(NSProgress*)parentProgressOrNil
422 userInfo:(NSDictionary*)userInfoOrNil;
423 @property(copy) NSString* kind;
424
425 @property int64_t totalUnitCount;
426 @property int64_t completedUnitCount;
427
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;
436
437 - (void)setUserInfoObject:(id)objectOrNil forKey:(NSString*)key;
438 - (NSDictionary*)userInfo;
439
440 @property(readonly, getter=isIndeterminate) BOOL indeterminate;
441 @property(readonly) double fractionCompleted;
442
443 - (void)publish;
444 - (void)unpublish;
445
446 @end
447
448 @interface NSScreen (MavericksSDK)
449 + (BOOL)screensHaveSeparateSpaces;
450 @end
451
452 @interface NSView (MavericksSDK)
453 - (void)setCanDrawSubviewsIntoLayer:(BOOL)flag;
454 - (NSAppearance*)effectiveAppearance;
455 @end
456
457 @interface NSWindow (MavericksSDK)
458 - (NSWindowOcclusionState)occlusionState;
459 @end
460
461 @interface NSAppearance (MavericksSDK)
462 + (id<NSObject>)appearanceNamed:(NSString*)name;
463 @end
464
465 @interface CBPeripheral (MavericksSDK)
466 @property(readonly, nonatomic) NSUUID* identifier;
467 @end
468
469 #endif // MAC_OS_X_VERSION_10_9
470
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
475
476 @interface NSUserActivity (YosemiteSDK)
477
478 @property(readonly, copy) NSString* activityType;
479 @property(copy) NSDictionary* userInfo;
480 @property(copy) NSURL* webpageURL;
481
482 - (instancetype)initWithActivityType:(NSString*)activityType;
483 - (void)becomeCurrent;
484 - (void)invalidate;
485
486 @end
487
488 @interface CBUUID (YosemiteSDK)
489 - (NSString*)UUIDString;
490 @end
491
492 #endif // MAC_OS_X_VERSION_10_10
493
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.
499 //
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;
515
516 @interface CWNetwork (SnowLeopardSDK)
517 @property(readonly) NSNumber* rssi;
518 @property(readonly) NSNumber* securityMode;
519 @end
520 #endif
521
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_
OLDNEW
« no previous file with comments | « base/mac/scoped_typeref.h ('k') | base/mac/sdk_forward_declarations.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698