diff --git a/shell/browser/api/atom_api_system_preferences_mac.mm b/shell/browser/api/atom_api_system_preferences_mac.mm index b1681a871f53..179202d77ef0 100644 --- a/shell/browser/api/atom_api_system_preferences_mac.mm +++ b/shell/browser/api/atom_api_system_preferences_mac.mm @@ -103,21 +103,6 @@ AVMediaType ParseMediaType(const std::string& media_type) { } } -std::string ConvertAuthorizationStatus(AVAuthorizationStatusMac status) { - switch (status) { - case AVAuthorizationStatusNotDeterminedMac: - return "not-determined"; - case AVAuthorizationStatusRestrictedMac: - return "restricted"; - case AVAuthorizationStatusDeniedMac: - return "denied"; - case AVAuthorizationStatusAuthorizedMac: - return "granted"; - default: - return "unknown"; - } -} - } // namespace void SystemPreferences::PostNotification(const std::string& name, @@ -591,11 +576,21 @@ std::string SystemPreferences::GetMediaAccessStatus( gin_helper::Arguments* args) { if (auto type = ParseMediaType(media_type)) { if (@available(macOS 10.14, *)) { - return ConvertAuthorizationStatus( - [AVCaptureDevice authorizationStatusForMediaType:type]); + switch ([AVCaptureDevice authorizationStatusForMediaType:type]) { + case AVAuthorizationStatusNotDetermined: + return "not-determined"; + case AVAuthorizationStatusRestricted: + return "restricted"; + case AVAuthorizationStatusDenied: + return "denied"; + case AVAuthorizationStatusAuthorized: + return "granted"; + default: + return "unknown"; + } } else { // access always allowed pre-10.14 Mojave - return ConvertAuthorizationStatus(AVAuthorizationStatusAuthorizedMac); + return "granted"; } } else { args->ThrowError("Invalid media type"); diff --git a/shell/browser/mac/atom_application.h b/shell/browser/mac/atom_application.h index 0058b8e852af..a9d1817b4e6e 100644 --- a/shell/browser/mac/atom_application.h +++ b/shell/browser/mac/atom_application.h @@ -9,80 +9,6 @@ #import #import -// Forward Declare Appearance APIs -@interface NSApplication (MojaveSDK) -@property(copy, readonly) - NSAppearance* effectiveAppearance API_AVAILABLE(macosx(10.14)); -@property(copy, readonly) NSAppearance* appearance API_AVAILABLE(macosx(10.14)); -- (void)setAppearance:(NSAppearance*)appearance API_AVAILABLE(macosx(10.14)); -@end - -// forward declare Access APIs -typedef NSString* AVMediaType NS_EXTENSIBLE_STRING_ENUM; - -AVF_EXPORT AVMediaType const AVMediaTypeVideo; -AVF_EXPORT AVMediaType const AVMediaTypeAudio; - -typedef NS_ENUM(NSInteger, AVAuthorizationStatusMac) { - AVAuthorizationStatusNotDeterminedMac = 0, - AVAuthorizationStatusRestrictedMac = 1, - AVAuthorizationStatusDeniedMac = 2, - AVAuthorizationStatusAuthorizedMac = 3, -}; - -@interface AVCaptureDevice (MojaveSDK) -+ (void)requestAccessForMediaType:(AVMediaType)mediaType - completionHandler:(void (^)(BOOL granted))handler - API_AVAILABLE(macosx(10.14)); -+ (AVAuthorizationStatusMac)authorizationStatusForMediaType: - (AVMediaType)mediaType API_AVAILABLE(macosx(10.14)); -@end - -@interface NSColor (MojaveSDK) -@property(class, strong, readonly) - NSColor* controlAccentColor API_AVAILABLE(macosx(10.14)); - -// macOS system colors -@property(class, strong, readonly) - NSColor* systemBlueColor API_AVAILABLE(macosx(10.10)); -@property(class, strong, readonly) - NSColor* systemBrownColor API_AVAILABLE(macosx(10.10)); -@property(class, strong, readonly) - NSColor* systemGrayColor API_AVAILABLE(macosx(10.10)); -@property(class, strong, readonly) - NSColor* systemGreenColor API_AVAILABLE(macosx(10.10)); -@property(class, strong, readonly) - NSColor* systemOrangeColor API_AVAILABLE(macosx(10.10)); -@property(class, strong, readonly) - NSColor* systemPinkColor API_AVAILABLE(macosx(10.10)); -@property(class, strong, readonly) - NSColor* systemPurpleColor API_AVAILABLE(macosx(10.10)); -@property(class, strong, readonly) - NSColor* systemRedColor API_AVAILABLE(macosx(10.10)); -@property(class, strong, readonly) - NSColor* systemYellowColor API_AVAILABLE(macosx(10.10)); - -// misc dynamic colors declarations -@property(class, strong, readonly) - NSColor* linkColor API_AVAILABLE(macosx(10.10)); -@property(class, strong, readonly) - NSColor* placeholderTextColor API_AVAILABLE(macosx(10.10)); -@property(class, strong, readonly) - NSColor* findHighlightColor API_AVAILABLE(macosx(10.13)); -@property(class, strong, readonly) - NSColor* separatorColor API_AVAILABLE(macosx(10.14)); -@property(class, strong, readonly) - NSColor* selectedContentBackgroundColor API_AVAILABLE(macosx(10.14)); -@property(class, strong, readonly) - NSColor* unemphasizedSelectedContentBackgroundColor API_AVAILABLE( - macosx(10.14)); -@property(class, strong, readonly) - NSColor* unemphasizedSelectedTextBackgroundColor API_AVAILABLE(macosx(10.14) - ); -@property(class, strong, readonly) - NSColor* unemphasizedSelectedTextColor API_AVAILABLE(macosx(10.14)); -@end - @interface AtomApplication : NSApplication { diff --git a/spec-main/node-spec.ts b/spec-main/node-spec.ts index 10c8f73bbd01..6f6a8d85a34a 100644 --- a/spec-main/node-spec.ts +++ b/spec-main/node-spec.ts @@ -68,7 +68,7 @@ describe('node feature', () => { }) it('fails for options disallowed by Node.js itself', (done) => { - const env = Object.assign({}, process.env, { NODE_OPTIONS: '--v8-options' }); + const env = Object.assign({}, process.env, { NODE_OPTIONS: '--v8-options' }) child = childProcess.spawn(process.execPath, { env }) function cleanup () { @@ -89,7 +89,7 @@ describe('node feature', () => { }) it('disallows crypto-related options', (done) => { - const env = Object.assign({}, process.env, { NODE_OPTIONS: '--use-openssl-ca' }); + const env = Object.assign({}, process.env, { NODE_OPTIONS: '--use-openssl-ca' }) child = childProcess.spawn(process.execPath, ['--enable-logging'], { env }) function cleanup () {