Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/accessibility/platform/ax_platform_node_mac.h" | 5 #import "ui/accessibility/platform/ax_platform_node_mac.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute]) { | 376 isEqualToString:NSAccessibilityVisibleCharacterRangeAttribute]) { |
| 377 return NO; | 377 return NO; |
| 378 } | 378 } |
| 379 | 379 |
| 380 if ([attributeName isEqualToString:NSAccessibilityValueAttribute] || | 380 if ([attributeName isEqualToString:NSAccessibilityValueAttribute] || |
| 381 [attributeName isEqualToString:NSAccessibilitySelectedTextAttribute]) | 381 [attributeName isEqualToString:NSAccessibilitySelectedTextAttribute]) |
| 382 return node_->GetDelegate()->CanSetStringValue(); | 382 return node_->GetDelegate()->CanSetStringValue(); |
| 383 | 383 |
| 384 if ([attributeName isEqualToString:NSAccessibilityFocusedAttribute]) { | 384 if ([attributeName isEqualToString:NSAccessibilityFocusedAttribute]) { |
| 385 if (ui::AXNodeData::IsFlagSet(node_->GetData().state, | 385 if (ui::AXNodeData::IsFlagSet(node_->GetData().state, |
| 386 ui::AX_STATE_FOCUSABLE)) | 386 ui::AX_STATE_FOCUSABLE)) |
|
tapted
2016/11/11 00:36:25
nit: needs curlies now that the block below goes o
Patti Lor
2016/11/14 03:51:21
Oops, yeah this is definitely a mistake. Fixed now
| |
| 387 return NO; | 387 return ui::AXNodeData::IsFlagSet(node_->GetData().state, |
| 388 ui::AX_STATE_FOCUSABLE); | |
| 388 } | 389 } |
| 389 | 390 |
| 390 // TODO(patricialor): Add callbacks for updating the above attributes except | 391 // TODO(patricialor): Add callbacks for updating the above attributes except |
| 391 // NSAccessibilityValueAttribute and return YES. | 392 // NSAccessibilityValueAttribute and return YES. |
| 392 return NO; | 393 return NO; |
| 393 } | 394 } |
| 394 | 395 |
| 395 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { | 396 - (void)accessibilitySetValue:(id)value forAttribute:(NSString*)attribute { |
| 396 if ([attribute isEqualToString:NSAccessibilityValueAttribute] && | 397 if ([value isKindOfClass:[NSString class]]) { |
| 397 [value isKindOfClass:[NSString class]]) { | 398 if ([attribute isEqualToString:NSAccessibilityValueAttribute]) { |
| 398 node_->GetDelegate()->SetStringValue(base::SysNSStringToUTF16(value), true); | 399 node_->GetDelegate()->SetStringValue(base::SysNSStringToUTF16(value), |
| 399 } else if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute] && | 400 true); |
| 400 [value isKindOfClass:[NSString class]]) { | 401 } else if ([attribute |
| 401 node_->GetDelegate()->SetStringValue(base::SysNSStringToUTF16(value), | 402 isEqualToString:NSAccessibilitySelectedTextAttribute]) { |
| 402 false); | 403 node_->GetDelegate()->SetStringValue(base::SysNSStringToUTF16(value), |
| 404 false); | |
| 405 } | |
| 406 } else if ([value isKindOfClass:[NSNumber class]]) { | |
| 407 if ([attribute isEqualToString:NSAccessibilityFocusedAttribute]) { | |
| 408 node_->GetDelegate()->SetFocused([value boolValue]); | |
| 409 } | |
| 403 } | 410 } |
| 404 | 411 |
| 405 // TODO(patricialor): Plumb through all the other writable attributes as | 412 // TODO(patricialor): Plumb through all the other writable attributes as |
| 406 // specified in accessibilityIsAttributeSettable. | 413 // specified in accessibilityIsAttributeSettable. |
| 407 } | 414 } |
| 408 | 415 |
| 409 - (id)accessibilityAttributeValue:(NSString*)attribute { | 416 - (id)accessibilityAttributeValue:(NSString*)attribute { |
| 410 SEL selector = NSSelectorFromString(attribute); | 417 SEL selector = NSSelectorFromString(attribute); |
| 411 if ([self respondsToSelector:selector]) | 418 if ([self respondsToSelector:selector]) |
| 412 return [self performSelector:selector]; | 419 return [self performSelector:selector]; |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 } | 591 } |
| 585 NotifyMacEvent(native_node_, event_type); | 592 NotifyMacEvent(native_node_, event_type); |
| 586 } | 593 } |
| 587 | 594 |
| 588 int AXPlatformNodeMac::GetIndexInParent() { | 595 int AXPlatformNodeMac::GetIndexInParent() { |
| 589 // TODO(dmazzoni): implement this. http://crbug.com/396137 | 596 // TODO(dmazzoni): implement this. http://crbug.com/396137 |
| 590 return -1; | 597 return -1; |
| 591 } | 598 } |
| 592 | 599 |
| 593 } // namespace ui | 600 } // namespace ui |
| OLD | NEW |