OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/browser/accessibility/browser_accessibility_android.h" | 5 #include "content/browser/accessibility/browser_accessibility_android.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/browser/accessibility/browser_accessibility_manager_android.h" | 8 #include "content/browser/accessibility/browser_accessibility_manager_android.h" |
9 #include "content/common/accessibility_messages.h" | 9 #include "content/common/accessibility_messages.h" |
10 #include "content/common/accessibility_node_data.h" | 10 #include "content/common/accessibility_node_data.h" |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 for (uint32 i = 0; i < child_count(); i++) { | 277 for (uint32 i = 0; i < child_count(); i++) { |
278 BrowserAccessibility* child = children()[i]; | 278 BrowserAccessibility* child = children()[i]; |
279 text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText(); | 279 text += static_cast<BrowserAccessibilityAndroid*>(child)->GetText(); |
280 } | 280 } |
281 } | 281 } |
282 | 282 |
283 switch(role()) { | 283 switch(role()) { |
284 case blink::WebAXRoleImageMapLink: | 284 case blink::WebAXRoleImageMapLink: |
285 case blink::WebAXRoleLink: | 285 case blink::WebAXRoleLink: |
286 if (!text.empty()) | 286 if (!text.empty()) |
287 text += ASCIIToUTF16(" "); | 287 text += base::ASCIIToUTF16(" "); |
288 text += ASCIIToUTF16("Link"); | 288 text += base::ASCIIToUTF16("Link"); |
289 break; | 289 break; |
290 case blink::WebAXRoleHeading: | 290 case blink::WebAXRoleHeading: |
291 // Only append "heading" if this node already has text. | 291 // Only append "heading" if this node already has text. |
292 if (!text.empty()) | 292 if (!text.empty()) |
293 text += ASCIIToUTF16(" Heading"); | 293 text += base::ASCIIToUTF16(" Heading"); |
294 break; | 294 break; |
295 } | 295 } |
296 | 296 |
297 return text; | 297 return text; |
298 } | 298 } |
299 | 299 |
300 int BrowserAccessibilityAndroid::GetItemIndex() const { | 300 int BrowserAccessibilityAndroid::GetItemIndex() const { |
301 int index = 0; | 301 int index = 0; |
302 switch(role()) { | 302 switch(role()) { |
303 case blink::WebAXRoleListItem: | 303 case blink::WebAXRoleListItem: |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 BrowserAccessibility* child = children()[i]; | 555 BrowserAccessibility* child = children()[i]; |
556 if (child->role() != blink::WebAXRoleStaticText) | 556 if (child->role() != blink::WebAXRoleStaticText) |
557 return false; | 557 return false; |
558 } | 558 } |
559 return true; | 559 return true; |
560 } | 560 } |
561 | 561 |
562 bool BrowserAccessibilityAndroid::IsIframe() const { | 562 bool BrowserAccessibilityAndroid::IsIframe() const { |
563 base::string16 html_tag = GetString16Attribute( | 563 base::string16 html_tag = GetString16Attribute( |
564 AccessibilityNodeData::ATTR_HTML_TAG); | 564 AccessibilityNodeData::ATTR_HTML_TAG); |
565 return html_tag == ASCIIToUTF16("iframe"); | 565 return html_tag == base::ASCIIToUTF16("iframe"); |
566 } | 566 } |
567 | 567 |
568 void BrowserAccessibilityAndroid::PostInitialize() { | 568 void BrowserAccessibilityAndroid::PostInitialize() { |
569 BrowserAccessibility::PostInitialize(); | 569 BrowserAccessibility::PostInitialize(); |
570 | 570 |
571 if (IsEditableText()) { | 571 if (IsEditableText()) { |
572 if (base::UTF8ToUTF16(value()) != new_value_) { | 572 if (base::UTF8ToUTF16(value()) != new_value_) { |
573 old_value_ = new_value_; | 573 old_value_ = new_value_; |
574 new_value_ = base::UTF8ToUTF16(value()); | 574 new_value_ = base::UTF8ToUTF16(value()); |
575 } | 575 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 blink::WebAXRole role) const { | 607 blink::WebAXRole role) const { |
608 int count = 0; | 608 int count = 0; |
609 for (uint32 i = 0; i < PlatformChildCount(); i++) { | 609 for (uint32 i = 0; i < PlatformChildCount(); i++) { |
610 if (PlatformGetChild(i)->role() == role) | 610 if (PlatformGetChild(i)->role() == role) |
611 count++; | 611 count++; |
612 } | 612 } |
613 return count; | 613 return count; |
614 } | 614 } |
615 | 615 |
616 } // namespace content | 616 } // namespace content |
OLD | NEW |