| 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 #include <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Also calls PreviousAtGranularity from the end back to the beginning | 65 // Also calls PreviousAtGranularity from the end back to the beginning |
| 66 // and fails (by logging an error and returning the empty string) if | 66 // and fails (by logging an error and returning the empty string) if |
| 67 // the result when traversing backwards is not the same | 67 // the result when traversing backwards is not the same |
| 68 // (but in reverse order). | 68 // (but in reverse order). |
| 69 base::string16 TraverseNodeAtGranularity( | 69 base::string16 TraverseNodeAtGranularity( |
| 70 BrowserAccessibility* node, | 70 BrowserAccessibility* node, |
| 71 int granularity) { | 71 int granularity) { |
| 72 AccessibilityNotificationWaiter waiter( | 72 AccessibilityNotificationWaiter waiter( |
| 73 shell()->web_contents(), AccessibilityModeComplete, | 73 shell()->web_contents(), AccessibilityModeComplete, |
| 74 ui::AX_EVENT_TREE_CHANGED); | 74 ui::AX_EVENT_TREE_CHANGED); |
| 75 node->manager()->SetAccessibilityFocus(*node); | 75 node->manager()->delegate()->AccessibilitySetAccessibilityFocus( |
| 76 node->GetId()); |
| 76 waiter.WaitForNotification(); | 77 waiter.WaitForNotification(); |
| 77 | 78 |
| 78 int start_index = -1; | 79 int start_index = -1; |
| 79 int end_index = -1; | 80 int end_index = -1; |
| 80 BrowserAccessibilityAndroid* android_node = | 81 BrowserAccessibilityAndroid* android_node = |
| 81 static_cast<BrowserAccessibilityAndroid*>(node); | 82 static_cast<BrowserAccessibilityAndroid*>(node); |
| 82 BrowserAccessibilityManagerAndroid* manager = | 83 BrowserAccessibilityManagerAndroid* manager = |
| 83 static_cast<BrowserAccessibilityManagerAndroid*>(node->manager()); | 84 static_cast<BrowserAccessibilityManagerAndroid*>(node->manager()); |
| 84 base::string16 text = android_node->GetText(); | 85 base::string16 text = android_node->GetText(); |
| 85 base::string16 concatenated; | 86 base::string16 concatenated; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); | 202 BrowserAccessibility* root = LoadUrlAndGetAccessibilityRoot(url); |
| 202 ASSERT_EQ(1U, root->PlatformChildCount()); | 203 ASSERT_EQ(1U, root->PlatformChildCount()); |
| 203 BrowserAccessibility* pre = root->PlatformGetChild(0); | 204 BrowserAccessibility* pre = root->PlatformGetChild(0); |
| 204 ASSERT_EQ(0U, pre->PlatformChildCount()); | 205 ASSERT_EQ(0U, pre->PlatformChildCount()); |
| 205 | 206 |
| 206 ASSERT_EQ(base::ASCIIToUTF16("'One,', 'two,', 'three!'"), | 207 ASSERT_EQ(base::ASCIIToUTF16("'One,', 'two,', 'three!'"), |
| 207 TraverseNodeAtGranularity(pre, GRANULARITY_LINE)); | 208 TraverseNodeAtGranularity(pre, GRANULARITY_LINE)); |
| 208 } | 209 } |
| 209 | 210 |
| 210 } // namespace content | 211 } // namespace content |
| OLD | NEW |