OLD | NEW |
---|---|
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include <execinfo.h> | 5 #include <execinfo.h> |
6 | 6 |
7 #import "chrome/browser/accessibility/browser_accessibility_cocoa.h" | 7 #import "chrome/browser/accessibility/browser_accessibility_cocoa.h" |
8 | 8 |
9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 } | 293 } |
294 | 294 |
295 // Returns an array of action names that this object will respond to. | 295 // Returns an array of action names that this object will respond to. |
296 - (NSArray*)accessibilityActionNames { | 296 - (NSArray*)accessibilityActionNames { |
297 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; | 297 NSMutableArray* ret = [[[NSMutableArray alloc] init] autorelease]; |
298 | 298 |
299 // General actions. | 299 // General actions. |
300 [ret addObject:NSAccessibilityShowMenuAction]; | 300 [ret addObject:NSAccessibilityShowMenuAction]; |
301 | 301 |
302 // TODO(dtseng): this should only get set when there's a default action. | 302 // TODO(dtseng): this should only get set when there's a default action. |
303 if ([self role] != NSAccessibilityStaticTextRole) | 303 if ([self role] != NSAccessibilityStaticTextRole || |
304 [self role] != NSAccessibilityTextAreaRole || | |
305 [self role] != NSAccessibilityTextFieldRole) { | |
304 [ret addObject:NSAccessibilityPressAction]; | 306 [ret addObject:NSAccessibilityPressAction]; |
307 } | |
305 | 308 |
306 return ret; | 309 return ret; |
307 } | 310 } |
308 | 311 |
309 // Returns a sub-array of values for the given attribute value, starting at | 312 // Returns a sub-array of values for the given attribute value, starting at |
310 // index, with up to maxCount items. If the given index is out of bounds, | 313 // index, with up to maxCount items. If the given index is out of bounds, |
311 // or there are no values for the given attribute, it will return nil. | 314 // or there are no values for the given attribute, it will return nil. |
312 // This method is used for querying subsets of values, without having to | 315 // This method is used for querying subsets of values, without having to |
313 // return a large set of data, such as elements with a large number of | 316 // return a large set of data, such as elements with a large number of |
314 // children. | 317 // children. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
403 // Returns whether or not this object should be ignored in the accessibilty | 406 // Returns whether or not this object should be ignored in the accessibilty |
404 // tree. | 407 // tree. |
405 - (BOOL)accessibilityIsIgnored { | 408 - (BOOL)accessibilityIsIgnored { |
406 return [self isIgnored]; | 409 return [self isIgnored]; |
407 } | 410 } |
408 | 411 |
409 // Performs the given accessibilty action on the webkit accessibility object | 412 // Performs the given accessibilty action on the webkit accessibility object |
410 // that backs this object. | 413 // that backs this object. |
411 - (void)accessibilityPerformAction:(NSString*)action { | 414 - (void)accessibilityPerformAction:(NSString*)action { |
412 // TODO(feldstein): Support more actions. | 415 // TODO(feldstein): Support more actions. |
413 [delegate_ doDefaultAction:browserAccessibility_->renderer_id()]; | 416 if ([action isEqualToString:NSAccessibilityPressAction]) |
Chris Guillory
2010/12/06 19:46:46
Include braces for this if statement since you are
| |
417 [delegate_ doDefaultAction:browserAccessibility_->renderer_id()]; | |
418 else if ([action isEqualToString:NSAccessibilityShowMenuAction]) { | |
419 // TODO(dtseng): implement. | |
420 } | |
414 } | 421 } |
415 | 422 |
416 // Returns the description of the given action. | 423 // Returns the description of the given action. |
417 - (NSString*)accessibilityActionDescription:(NSString*)action { | 424 - (NSString*)accessibilityActionDescription:(NSString*)action { |
418 return NSAccessibilityActionDescription(action); | 425 return NSAccessibilityActionDescription(action); |
419 } | 426 } |
420 | 427 |
421 // Sets an override value for a specific accessibility attribute. | 428 // Sets an override value for a specific accessibility attribute. |
422 // This class does not support this. | 429 // This class does not support this. |
423 - (BOOL)accessibilitySetOverrideValue:(id)value | 430 - (BOOL)accessibilitySetOverrideValue:(id)value |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
466 | 473 |
467 - (NSUInteger)hash { | 474 - (NSUInteger)hash { |
468 // Potentially called during dealloc. | 475 // Potentially called during dealloc. |
469 if (!browserAccessibility_) | 476 if (!browserAccessibility_) |
470 return [super hash]; | 477 return [super hash]; |
471 return browserAccessibility_->renderer_id(); | 478 return browserAccessibility_->renderer_id(); |
472 } | 479 } |
473 | 480 |
474 @end | 481 @end |
475 | 482 |
OLD | NEW |