Chromium Code Reviews| 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 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 return BrowserAccessibility::PlatformIsLeaf(); | 90 return BrowserAccessibility::PlatformIsLeaf(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 bool BrowserAccessibilityAndroid::IsCheckable() const { | 93 bool BrowserAccessibilityAndroid::IsCheckable() const { |
| 94 bool checkable = false; | 94 bool checkable = false; |
| 95 bool is_aria_pressed_defined; | 95 bool is_aria_pressed_defined; |
| 96 bool is_mixed; | 96 bool is_mixed; |
| 97 GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed); | 97 GetAriaTristate("aria-pressed", &is_aria_pressed_defined, &is_mixed); |
| 98 if (GetRole() == ui::AX_ROLE_CHECK_BOX || | 98 if (GetRole() == ui::AX_ROLE_CHECK_BOX || |
| 99 GetRole() == ui::AX_ROLE_RADIO_BUTTON || | 99 GetRole() == ui::AX_ROLE_RADIO_BUTTON || |
| 100 GetRole() == ui::AX_ROLE_CHECK_BOX_MENU_ITEM || | |
|
dmazzoni
2014/10/08 18:59:15
Any reason not to do RADIO_MENU_ITEM in the same c
shreeramk
2014/10/08 19:38:51
Because for radio with menu as parent, MenuItemRol
dmazzoni
2014/10/08 19:41:40
Ah, OK - can you do that in a separate change?
| |
| 100 is_aria_pressed_defined) { | 101 is_aria_pressed_defined) { |
| 101 checkable = true; | 102 checkable = true; |
| 102 } | 103 } |
| 103 if (HasState(ui::AX_STATE_CHECKED)) | 104 if (HasState(ui::AX_STATE_CHECKED)) |
| 104 checkable = true; | 105 checkable = true; |
| 105 return checkable; | 106 return checkable; |
| 106 } | 107 } |
| 107 | 108 |
| 108 bool BrowserAccessibilityAndroid::IsChecked() const { | 109 bool BrowserAccessibilityAndroid::IsChecked() const { |
| 109 return HasState(ui::AX_STATE_CHECKED); | 110 return HasState(ui::AX_STATE_CHECKED); |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 break; | 222 break; |
| 222 case ui::AX_ROLE_COMBO_BOX: | 223 case ui::AX_ROLE_COMBO_BOX: |
| 223 class_name = "android.widget.Spinner"; | 224 class_name = "android.widget.Spinner"; |
| 224 break; | 225 break; |
| 225 case ui::AX_ROLE_BUTTON: | 226 case ui::AX_ROLE_BUTTON: |
| 226 case ui::AX_ROLE_MENU_BUTTON: | 227 case ui::AX_ROLE_MENU_BUTTON: |
| 227 case ui::AX_ROLE_POP_UP_BUTTON: | 228 case ui::AX_ROLE_POP_UP_BUTTON: |
| 228 class_name = "android.widget.Button"; | 229 class_name = "android.widget.Button"; |
| 229 break; | 230 break; |
| 230 case ui::AX_ROLE_CHECK_BOX: | 231 case ui::AX_ROLE_CHECK_BOX: |
| 232 case ui::AX_ROLE_CHECK_BOX_MENU_ITEM: | |
| 231 class_name = "android.widget.CheckBox"; | 233 class_name = "android.widget.CheckBox"; |
| 232 break; | 234 break; |
| 233 case ui::AX_ROLE_RADIO_BUTTON: | 235 case ui::AX_ROLE_RADIO_BUTTON: |
| 234 class_name = "android.widget.RadioButton"; | 236 class_name = "android.widget.RadioButton"; |
| 235 break; | 237 break; |
| 236 case ui::AX_ROLE_TOGGLE_BUTTON: | 238 case ui::AX_ROLE_TOGGLE_BUTTON: |
| 237 class_name = "android.widget.ToggleButton"; | 239 class_name = "android.widget.ToggleButton"; |
| 238 break; | 240 break; |
| 239 case ui::AX_ROLE_CANVAS: | 241 case ui::AX_ROLE_CANVAS: |
| 240 case ui::AX_ROLE_IMAGE: | 242 case ui::AX_ROLE_IMAGE: |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 644 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { | 646 int BrowserAccessibilityAndroid::CountChildrenWithRole(ui::AXRole role) const { |
| 645 int count = 0; | 647 int count = 0; |
| 646 for (uint32 i = 0; i < PlatformChildCount(); i++) { | 648 for (uint32 i = 0; i < PlatformChildCount(); i++) { |
| 647 if (PlatformGetChild(i)->GetRole() == role) | 649 if (PlatformGetChild(i)->GetRole() == role) |
| 648 count++; | 650 count++; |
| 649 } | 651 } |
| 650 return count; | 652 return count; |
| 651 } | 653 } |
| 652 | 654 |
| 653 } // namespace content | 655 } // namespace content |
| OLD | NEW |