Merge pull request #3040 from theojulienne/accessibility-fixes

Fix Text to Speech on OS X 10.11
This commit is contained in:
Cheng Zhao 2015-10-09 12:25:11 +08:00
commit 922fce1892
2 changed files with 11 additions and 2 deletions

View file

@ -43,11 +43,20 @@
atom::Browser::Get()->OpenURL(base::SysNSStringToUTF8(url));
}
- (bool)voiceOverEnabled {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults addSuiteNamed:@"com.apple.universalaccess"];
[defaults synchronize];
return [defaults boolForKey:@"voiceOverOnOffKey"];
}
- (void)accessibilitySetValue:(id)value forAttribute:(NSString *)attribute {
// Undocumented attribute that VoiceOver happens to set while running.
// Chromium uses this too, even though it's not exactly right.
if ([attribute isEqualToString:@"AXEnhancedUserInterface"]) {
[self updateAccessibilityEnabled:[value boolValue]];
bool enableAccessibility = ([self voiceOverEnabled] && [value boolValue]);
[self updateAccessibilityEnabled:enableAccessibility];
}
return [super accessibilitySetValue:value forAttribute:attribute];
}

View file

@ -20,7 +20,7 @@ void ShowItemInFolder(const base::FilePath& full_path) {
DCHECK([NSThread isMainThread]);
NSString* path_string = base::SysUTF8ToNSString(full_path.value());
if (!path_string || ![[NSWorkspace sharedWorkspace] selectFile:path_string
inFileViewerRootedAtPath:nil])
inFileViewerRootedAtPath:@""])
LOG(WARNING) << "NSWorkspace failed to select file " << full_path.value();
}