• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #if !defined(MAC_OS_X_VERSION_10_7) || \
22     MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
23 
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
31 };
32 typedef NSUInteger NSEventPhase;
33 
34 enum {
35   NSFullScreenWindowMask = 1 << 14,
36 };
37 
38 enum {
39   NSApplicationPresentationFullScreen = 1 << 10,
40 };
41 
42 enum {
43   NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
44   NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8,
45 };
46 
47 enum {
48   NSEventSwipeTrackingLockDirection = 0x1 << 0,
49   NSEventSwipeTrackingClampGestureAmount = 0x1 << 1,
50 };
51 typedef NSUInteger NSEventSwipeTrackingOptions;
52 
53 enum {
54   NSWindowAnimationBehaviorDefault = 0,
55   NSWindowAnimationBehaviorNone = 2,
56   NSWindowAnimationBehaviorDocumentWindow = 3,
57   NSWindowAnimationBehaviorUtilityWindow = 4,
58   NSWindowAnimationBehaviorAlertPanel = 5
59 };
60 typedef NSInteger NSWindowAnimationBehavior;
61 
62 enum {
63   NSWindowDocumentVersionsButton = 6,
64   NSWindowFullScreenButton,
65 };
66 typedef NSUInteger NSWindowButton;
67 
68 @interface NSEvent (LionSDK)
69 + (BOOL)isSwipeTrackingFromScrollEventsEnabled;
70 
71 - (NSEventPhase)momentumPhase;
72 - (NSEventPhase)phase;
73 - (CGFloat)scrollingDeltaX;
74 - (CGFloat)scrollingDeltaY;
75 - (void)trackSwipeEventWithOptions:(NSEventSwipeTrackingOptions)options
76           dampenAmountThresholdMin:(CGFloat)minDampenThreshold
77                                max:(CGFloat)maxDampenThreshold
78                       usingHandler:(void (^)(CGFloat gestureAmount,
79                                              NSEventPhase phase,
80                                              BOOL isComplete,
81                                              BOOL *stop))trackingHandler;
82 
83 - (BOOL)isDirectionInvertedFromDevice;
84 
85 @end
86 
87 @interface NSApplication (LionSDK)
88 - (void)disableRelaunchOnLogin;
89 @end
90 
91 @interface CALayer (LionSDK)
92 - (CGFloat)contentsScale;
93 - (void)setContentsScale:(CGFloat)contentsScale;
94 @end
95 
96 @interface NSScreen (LionSDK)
97 - (CGFloat)backingScaleFactor;
98 - (NSRect)convertRectToBacking:(NSRect)aRect;
99 @end
100 
101 @interface NSWindow (LionSDK)
102 - (CGFloat)backingScaleFactor;
103 - (NSWindowAnimationBehavior)animationBehavior;
104 - (void)setAnimationBehavior:(NSWindowAnimationBehavior)newAnimationBehavior;
105 - (void)toggleFullScreen:(id)sender;
106 - (void)setRestorable:(BOOL)flag;
107 @end
108 
109 @interface NSCursor (LionSDKDeclarations)
110 + (NSCursor*)IBeamCursorForVerticalLayout;
111 @end
112 
113 @interface NSAnimationContext (LionSDK)
114 + (void)runAnimationGroup:(void (^)(NSAnimationContext *context))changes
115         completionHandler:(void (^)(void))completionHandler;
116 @property(copy) void(^completionHandler)(void);
117 @end
118 
119 @interface NSView (LionSDK)
120 - (NSSize)convertSizeFromBacking:(NSSize)size;
121 - (void)setWantsBestResolutionOpenGLSurface:(BOOL)flag;
122 @end
123 
124 @interface NSObject (ICCameraDeviceDelegateLionSDK)
125 - (void)deviceDidBecomeReadyWithCompleteContentCatalog:(ICDevice*)device;
126 - (void)didDownloadFile:(ICCameraFile*)file
127                   error:(NSError*)error
128                 options:(NSDictionary*)options
129             contextInfo:(void*)contextInfo;
130 @end
131 
132 @interface NSScroller (LionSDK)
133 + (NSInteger)preferredScrollerStyle;
134 @end
135 
136 @interface CWInterface (LionSDK)
137 - (BOOL)associateToNetwork:(CWNetwork*)network
138                   password:(NSString*)password
139                      error:(NSError**)error;
140 - (NSSet*)scanForNetworksWithName:(NSString*)networkName
141                             error:(NSError**)error;
142 @end
143 
144 enum CWChannelBand {
145   kCWChannelBandUnknown = 0,
146   kCWChannelBand2GHz = 1,
147   kCWChannelBand5GHz = 2,
148 };
149 
150 @interface CWChannel : NSObject
151 @property(readonly) CWChannelBand channelBand;
152 @end
153 
154 @interface CWNetwork (LionSDK)
155 @property(readonly) CWChannel* wlanChannel;
156 @end
157 
158 @interface IOBluetoothHostController (LionSDK)
159 - (NSString*)nameAsString;
160 - (BluetoothHCIPowerState)powerState;
161 @end
162 
163 @protocol IOBluetoothDeviceInquiryDelegate
164 - (void)deviceInquiryStarted:(IOBluetoothDeviceInquiry*)sender;
165 - (void)deviceInquiryDeviceFound:(IOBluetoothDeviceInquiry*)sender
166                           device:(IOBluetoothDevice*)device;
167 - (void)deviceInquiryComplete:(IOBluetoothDeviceInquiry*)sender
168                         error:(IOReturn)error
169                       aborted:(BOOL)aborted;
170 @end
171 
172 @interface IOBluetoothL2CAPChannel (LionSDK)
173 @property(readonly) BluetoothL2CAPMTU outgoingMTU;
174 @end
175 
176 @interface IOBluetoothDevice (LionSDK)
177 - (NSString*)addressString;
178 - (unsigned int)classOfDevice;
179 - (BluetoothConnectionHandle)connectionHandle;
180 - (BluetoothHCIRSSIValue)rawRSSI;
181 - (NSArray*)services;
182 - (IOReturn)performSDPQuery:(id)target uuids:(NSArray*)uuids;
183 @end
184 
185 BASE_EXPORT extern "C" NSString* const NSWindowWillEnterFullScreenNotification;
186 
187 #endif  // MAC_OS_X_VERSION_10_7
188 
189 #if !defined(MAC_OS_X_VERSION_10_8) || \
190     MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_8
191 
192 enum {
193   NSEventPhaseMayBegin    = 0x1 << 5
194 };
195 
196 #endif  // MAC_OS_X_VERSION_10_8
197 
198 
199 #if !defined(MAC_OS_X_VERSION_10_9) || \
200     MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_9
201 
202 // NSProgress is public API in 10.9, but a version of it exists and is usable
203 // in 10.8.
204 
205 @interface NSProgress : NSObject
206 
207 - (instancetype)initWithParent:(NSProgress*)parentProgressOrNil
208                       userInfo:(NSDictionary*)userInfoOrNil;
209 @property (copy) NSString* kind;
210 
211 @property int64_t totalUnitCount;
212 @property int64_t completedUnitCount;
213 
214 @property (getter=isCancellable) BOOL cancellable;
215 @property (getter=isPausable) BOOL pausable;
216 @property (readonly, getter=isCancelled) BOOL cancelled;
217 @property (readonly, getter=isPaused) BOOL paused;
218 @property (copy) void (^cancellationHandler)(void);
219 @property (copy) void (^pausingHandler)(void);
220 - (void)cancel;
221 - (void)pause;
222 
223 - (void)setUserInfoObject:(id)objectOrNil forKey:(NSString*)key;
224 - (NSDictionary*)userInfo;
225 
226 @property (readonly, getter=isIndeterminate) BOOL indeterminate;
227 @property (readonly) double fractionCompleted;
228 
229 - (void)publish;
230 - (void)unpublish;
231 
232 @end
233 
234 @interface NSView (MavericksSDK)
235 - (void)setCanDrawSubviewsIntoLayer:(BOOL)flag;
236 @end
237 
238 enum {
239   NSWindowOcclusionStateVisible = 1UL << 1,
240 };
241 typedef NSUInteger NSWindowOcclusionState;
242 
243 @interface NSWindow (MavericksSDK)
244 - (NSWindowOcclusionState)occlusionState;
245 @end
246 
247 #endif  // MAC_OS_X_VERSION_10_9
248 
249 
250 #if !defined(MAC_OS_X_VERSION_10_10) || \
251     MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_10
252 
253 enum {
254   NSWindowTitleVisible  = 0,
255   NSWindowTitleHidden = 1,
256   NSWindowTitleHiddenWhenActive = 2,
257 };
258 typedef NSInteger NSWindowTitleVisibility;
259 
260 @interface NSWindow (YosemiteSDK)
261 
262 @property NSWindowTitleVisibility titleVisibility;
263 
264 @end
265 
266 #endif  // MAC_OS_X_VERSION_10_10
267 
268 #endif  // BASE_MAC_SDK_FORWARD_DECLARATIONS_H_
269