atom_application.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. // Copyright (c) 2013 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "base/callback.h"
  5. #include "base/mac/scoped_nsobject.h"
  6. #include "base/mac/scoped_sending_event.h"
  7. #import <AVFoundation/AVFoundation.h>
  8. // Forward Declare Appearance APIs
  9. @interface NSApplication (HighSierraSDK)
  10. @property(copy, readonly)
  11. NSAppearance* effectiveAppearance API_AVAILABLE(macosx(10.14));
  12. @property(copy, readonly) NSAppearance* appearance API_AVAILABLE(macosx(10.14));
  13. - (void)setAppearance:(NSAppearance*)appearance API_AVAILABLE(macosx(10.14));
  14. @end
  15. // forward declare Access APIs
  16. typedef NSString* AVMediaType NS_EXTENSIBLE_STRING_ENUM;
  17. AVF_EXPORT AVMediaType const AVMediaTypeVideo;
  18. AVF_EXPORT AVMediaType const AVMediaTypeAudio;
  19. typedef NS_ENUM(NSInteger, AVAuthorizationStatusMac) {
  20. AVAuthorizationStatusNotDeterminedMac = 0,
  21. AVAuthorizationStatusRestrictedMac = 1,
  22. AVAuthorizationStatusDeniedMac = 2,
  23. AVAuthorizationStatusAuthorizedMac = 3,
  24. };
  25. @interface AVCaptureDevice (MojaveSDK)
  26. + (void)requestAccessForMediaType:(AVMediaType)mediaType
  27. completionHandler:(void (^)(BOOL granted))handler
  28. API_AVAILABLE(macosx(10.14));
  29. + (AVAuthorizationStatusMac)authorizationStatusForMediaType:
  30. (AVMediaType)mediaType API_AVAILABLE(macosx(10.14));
  31. @end
  32. extern "C" {
  33. #if !defined(MAC_OS_X_VERSION_10_14) || \
  34. MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_14
  35. BASE_EXPORT extern NSString* const NSAppearanceNameDarkAqua;
  36. #endif // MAC_OS_X_VERSION_10_14
  37. } // extern "C"
  38. @interface AtomApplication : NSApplication <CrAppProtocol,
  39. CrAppControlProtocol,
  40. NSUserActivityDelegate> {
  41. @private
  42. BOOL handlingSendEvent_;
  43. base::scoped_nsobject<NSUserActivity> currentActivity_
  44. API_AVAILABLE(macosx(10.10));
  45. NSCondition* handoffLock_;
  46. BOOL updateReceived_;
  47. base::Callback<bool()> shouldShutdown_;
  48. }
  49. + (AtomApplication*)sharedApplication;
  50. - (void)setShutdownHandler:(base::Callback<bool()>)handler;
  51. // CrAppProtocol:
  52. - (BOOL)isHandlingSendEvent;
  53. // CrAppControlProtocol:
  54. - (void)setHandlingSendEvent:(BOOL)handlingSendEvent;
  55. - (NSUserActivity*)getCurrentActivity API_AVAILABLE(macosx(10.10));
  56. - (void)setCurrentActivity:(NSString*)type
  57. withUserInfo:(NSDictionary*)userInfo
  58. withWebpageURL:(NSURL*)webpageURL;
  59. - (void)invalidateCurrentActivity;
  60. - (void)updateCurrentActivity:(NSString*)type
  61. withUserInfo:(NSDictionary*)userInfo;
  62. @end