chore: remove no longer needed macOS SDK forward declarations (#19918)
* chore: remove no longer needed macOS SDK forward declarations * fix: linter errors in spec-main/node-spec.ts
This commit is contained in:
parent
5f27c1fa25
commit
f808f50fa6
3 changed files with 15 additions and 94 deletions
|
@ -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
|
} // namespace
|
||||||
|
|
||||||
void SystemPreferences::PostNotification(const std::string& name,
|
void SystemPreferences::PostNotification(const std::string& name,
|
||||||
|
@ -591,11 +576,21 @@ std::string SystemPreferences::GetMediaAccessStatus(
|
||||||
gin_helper::Arguments* args) {
|
gin_helper::Arguments* args) {
|
||||||
if (auto type = ParseMediaType(media_type)) {
|
if (auto type = ParseMediaType(media_type)) {
|
||||||
if (@available(macOS 10.14, *)) {
|
if (@available(macOS 10.14, *)) {
|
||||||
return ConvertAuthorizationStatus(
|
switch ([AVCaptureDevice authorizationStatusForMediaType:type]) {
|
||||||
[AVCaptureDevice authorizationStatusForMediaType:type]);
|
case AVAuthorizationStatusNotDetermined:
|
||||||
|
return "not-determined";
|
||||||
|
case AVAuthorizationStatusRestricted:
|
||||||
|
return "restricted";
|
||||||
|
case AVAuthorizationStatusDenied:
|
||||||
|
return "denied";
|
||||||
|
case AVAuthorizationStatusAuthorized:
|
||||||
|
return "granted";
|
||||||
|
default:
|
||||||
|
return "unknown";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// access always allowed pre-10.14 Mojave
|
// access always allowed pre-10.14 Mojave
|
||||||
return ConvertAuthorizationStatus(AVAuthorizationStatusAuthorizedMac);
|
return "granted";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
args->ThrowError("Invalid media type");
|
args->ThrowError("Invalid media type");
|
||||||
|
|
|
@ -9,80 +9,6 @@
|
||||||
#import <AVFoundation/AVFoundation.h>
|
#import <AVFoundation/AVFoundation.h>
|
||||||
#import <LocalAuthentication/LocalAuthentication.h>
|
#import <LocalAuthentication/LocalAuthentication.h>
|
||||||
|
|
||||||
// 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 <CrAppProtocol,
|
@interface AtomApplication : NSApplication <CrAppProtocol,
|
||||||
CrAppControlProtocol,
|
CrAppControlProtocol,
|
||||||
NSUserActivityDelegate> {
|
NSUserActivityDelegate> {
|
||||||
|
|
|
@ -68,7 +68,7 @@ describe('node feature', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('fails for options disallowed by Node.js itself', (done) => {
|
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 })
|
child = childProcess.spawn(process.execPath, { env })
|
||||||
|
|
||||||
function cleanup () {
|
function cleanup () {
|
||||||
|
@ -89,7 +89,7 @@ describe('node feature', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('disallows crypto-related options', (done) => {
|
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 })
|
child = childProcess.spawn(process.execPath, ['--enable-logging'], { env })
|
||||||
|
|
||||||
function cleanup () {
|
function cleanup () {
|
||||||
|
|
Loading…
Add table
Reference in a new issue