feat: expose app accessibility status api (#16119)
* feat: expose app accessibility status api * fix prompt
This commit is contained in:
parent
dc93d94bc8
commit
a58d989b60
4 changed files with 15 additions and 0 deletions
|
@ -89,6 +89,8 @@ void SystemPreferences::BuildPrototype(
|
|||
&SystemPreferences::GetAppLevelAppearance)
|
||||
.SetMethod("setAppLevelAppearance",
|
||||
&SystemPreferences::SetAppLevelAppearance)
|
||||
.SetMethod("isTrustedAccessibilityClient",
|
||||
&SystemPreferences::IsTrustedAccessibilityClient)
|
||||
.SetMethod("getMediaAccessStatus",
|
||||
&SystemPreferences::GetMediaAccessStatus)
|
||||
.SetMethod("askForMediaAccess", &SystemPreferences::AskForMediaAccess)
|
||||
|
|
|
@ -92,6 +92,8 @@ class SystemPreferences : public mate::EventEmitter<SystemPreferences>
|
|||
void RemoveUserDefault(const std::string& name);
|
||||
bool IsSwipeTrackingFromScrollEventsEnabled();
|
||||
|
||||
bool IsTrustedAccessibilityClient(bool prompt);
|
||||
|
||||
// TODO(codebytere): Write tests for these methods once we
|
||||
// are running tests on a Mojave machine
|
||||
std::string GetMediaAccessStatus(const std::string& media_type,
|
||||
|
|
|
@ -378,6 +378,11 @@ void SystemPreferences::SetUserDefault(const std::string& name,
|
|||
}
|
||||
}
|
||||
|
||||
bool SystemPreferences::IsTrustedAccessibilityClient(bool prompt) {
|
||||
NSDictionary* options = @{(id)kAXTrustedCheckOptionPrompt : @(prompt)};
|
||||
return AXIsProcessTrustedWithOptions((CFDictionaryRef)options);
|
||||
}
|
||||
|
||||
std::string SystemPreferences::GetMediaAccessStatus(
|
||||
const std::string& media_type,
|
||||
mate::Arguments* args) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue