Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/chrome_browser_application_mac.h" | 5 #import "chrome/browser/chrome_browser_application_mac.h" |
| 6 | 6 |
| 7 #import "base/auto_reset.h" | 7 #import "base/auto_reset.h" |
| 8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
| 9 #import "base/logging.h" | 9 #import "base/logging.h" |
| 10 #import "base/mac/scoped_nsexception_enabler.h" | 10 #import "base/mac/scoped_nsexception_enabler.h" |
| 11 #import "base/memory/scoped_nsobject.h" | 11 #import "base/memory/scoped_nsobject.h" |
| 12 #import "base/metrics/histogram.h" | 12 #import "base/metrics/histogram.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #import "base/sys_string_conversions.h" | 14 #import "base/sys_string_conversions.h" |
| 15 #import "chrome/browser/app_controller_mac.h" | 15 #import "chrome/browser/app_controller_mac.h" |
| 16 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" | 16 #include "chrome/browser/ui/tab_contents/tab_contents_iterator.h" |
| 17 #include "chrome/common/crash_keys.h" | 17 #include "chrome/common/crash_keys.h" |
| 18 #import "chrome/common/mac/objc_method_swizzle.h" | 18 #import "chrome/common/mac/objc_method_swizzle.h" |
| 19 #import "chrome/common/mac/objc_zombie.h" | 19 #import "chrome/common/mac/objc_zombie.h" |
| 20 #include "content/public/browser/browser_accessibility_state.h" | 20 #include "content/public/browser/browser_accessibility_state.h" |
| 21 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
| 22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
| 23 #include "content/public/common/accessibility_mode.h" | |
|
jam
2013/02/27 19:35:50
nit: this seems redundant since by definition if y
aboxhall
2013/02/27 21:19:59
Fair enough. Removed.
| |
| 23 | 24 |
| 24 // The implementation of NSExceptions break various assumptions in the | 25 // The implementation of NSExceptions break various assumptions in the |
| 25 // Chrome code. This category defines a replacement for | 26 // Chrome code. This category defines a replacement for |
| 26 // -initWithName:reason:userInfo: for purposes of forcing a break in | 27 // -initWithName:reason:userInfo: for purposes of forcing a break in |
| 27 // the debugger when an exception is raised. -raise sounds more | 28 // the debugger when an exception is raised. -raise sounds more |
| 28 // obvious to intercept, but it doesn't catch the original throw | 29 // obvious to intercept, but it doesn't catch the original throw |
| 29 // because the objc runtime doesn't use it. | 30 // because the objc runtime doesn't use it. |
| 30 @interface NSException (CrNSExceptionSwizzle) | 31 @interface NSException (CrNSExceptionSwizzle) |
| 31 - (id)crInitWithName:(NSString*)aName | 32 - (id)crInitWithName:(NSString*)aName |
| 32 reason:(NSString*)aReason | 33 reason:(NSString*)aReason |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 [super reportException:anException]; | 498 [super reportException:anException]; |
| 498 } | 499 } |
| 499 | 500 |
| 500 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { | 501 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { |
| 501 if ([attribute isEqualToString:@"AXEnhancedUserInterface"] && | 502 if ([attribute isEqualToString:@"AXEnhancedUserInterface"] && |
| 502 [value intValue] == 1) { | 503 [value intValue] == 1) { |
| 503 content::BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); | 504 content::BrowserAccessibilityState::GetInstance()->OnScreenReaderDetected(); |
| 504 for (TabContentsIterator it; !it.done(); it.Next()) { | 505 for (TabContentsIterator it; !it.done(); it.Next()) { |
| 505 if (content::WebContents* contents = *it) | 506 if (content::WebContents* contents = *it) |
| 506 if (content::RenderViewHost* rvh = contents->GetRenderViewHost()) | 507 if (content::RenderViewHost* rvh = contents->GetRenderViewHost()) |
| 507 rvh->EnableFullAccessibilityMode(); | 508 rvh->SetAccessibilityMode(content::AccessibilityModeComplete); |
| 508 } | 509 } |
| 509 } | 510 } |
| 510 return [super accessibilitySetValue:value forAttribute:attribute]; | 511 return [super accessibilitySetValue:value forAttribute:attribute]; |
| 511 } | 512 } |
| 512 | 513 |
| 513 - (void)_cycleWindowsReversed:(BOOL)arg1 { | 514 - (void)_cycleWindowsReversed:(BOOL)arg1 { |
| 514 base::AutoReset<BOOL> pin(&cyclingWindows_, YES); | 515 base::AutoReset<BOOL> pin(&cyclingWindows_, YES); |
| 515 [super _cycleWindowsReversed:arg1]; | 516 [super _cycleWindowsReversed:arg1]; |
| 516 } | 517 } |
| 517 | 518 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 std::vector<NSWindow*>::iterator window_iterator = | 569 std::vector<NSWindow*>::iterator window_iterator = |
| 569 std::find(previousKeyWindows_.begin(), | 570 std::find(previousKeyWindows_.begin(), |
| 570 previousKeyWindows_.end(), | 571 previousKeyWindows_.end(), |
| 571 window); | 572 window); |
| 572 if (window_iterator != previousKeyWindows_.end()) { | 573 if (window_iterator != previousKeyWindows_.end()) { |
| 573 previousKeyWindows_.erase(window_iterator); | 574 previousKeyWindows_.erase(window_iterator); |
| 574 } | 575 } |
| 575 } | 576 } |
| 576 | 577 |
| 577 @end | 578 @end |
| OLD | NEW |