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 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H_ |
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H_ |
7 | 7 |
8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include "content/browser/accessibility/browser_accessibility_manager.h" | 9 #include "content/browser/accessibility/browser_accessibility_manager.h" |
10 #include "content/browser/android/content_view_core_impl.h" | 10 #include "content/browser/android/content_view_core_impl.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 BrowserAccessibilityDelegate* delegate, | 41 BrowserAccessibilityDelegate* delegate, |
42 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); | 42 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); |
43 | 43 |
44 ~BrowserAccessibilityManagerAndroid() override; | 44 ~BrowserAccessibilityManagerAndroid() override; |
45 | 45 |
46 static ui::AXTreeUpdate GetEmptyDocument(); | 46 static ui::AXTreeUpdate GetEmptyDocument(); |
47 | 47 |
48 void SetContentViewCore( | 48 void SetContentViewCore( |
49 base::android::ScopedJavaLocalRef<jobject> content_view_core); | 49 base::android::ScopedJavaLocalRef<jobject> content_view_core); |
50 | 50 |
| 51 // By default, the tree is pruned for a better screen reading experience, |
| 52 // including: |
| 53 // * If the node has only static text children |
| 54 // * If the node is focusable and has no focusable children |
| 55 // * If the node is a heading |
| 56 // This can be turned off to generate a tree that more accurately reflects |
| 57 // the DOM and includes style changes within these nodes. |
| 58 void set_prune_tree_for_screen_reader(bool prune) { |
| 59 prune_tree_for_screen_reader_ = prune; |
| 60 } |
| 61 bool prune_tree_for_screen_reader() { return prune_tree_for_screen_reader_; } |
| 62 |
51 // Implementation of BrowserAccessibilityManager. | 63 // Implementation of BrowserAccessibilityManager. |
52 void NotifyAccessibilityEvent(ui::AXEvent event_type, | 64 void NotifyAccessibilityEvent(ui::AXEvent event_type, |
53 BrowserAccessibility* node) override; | 65 BrowserAccessibility* node) override; |
54 | 66 |
55 // -------------------------------------------------------------------------- | 67 // -------------------------------------------------------------------------- |
56 // Methods called from Java via JNI | 68 // Methods called from Java via JNI |
57 // -------------------------------------------------------------------------- | 69 // -------------------------------------------------------------------------- |
58 | 70 |
59 // Tree methods. | 71 // Tree methods. |
60 jint GetRootId(JNIEnv* env, jobject obj); | 72 jint GetRootId(JNIEnv* env, jobject obj); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // A weak reference to the Java BrowserAccessibilityManager object. | 150 // A weak reference to the Java BrowserAccessibilityManager object. |
139 // This avoids adding another reference to BrowserAccessibilityManager and | 151 // This avoids adding another reference to BrowserAccessibilityManager and |
140 // preventing garbage collection. | 152 // preventing garbage collection. |
141 // Premature garbage collection is prevented by the long-lived reference in | 153 // Premature garbage collection is prevented by the long-lived reference in |
142 // ContentViewCore. | 154 // ContentViewCore. |
143 JavaObjectWeakGlobalRef java_ref_; | 155 JavaObjectWeakGlobalRef java_ref_; |
144 | 156 |
145 // Handle a hover event from the renderer process. | 157 // Handle a hover event from the renderer process. |
146 void HandleHoverEvent(BrowserAccessibility* node); | 158 void HandleHoverEvent(BrowserAccessibility* node); |
147 | 159 |
| 160 // See docs for set_prune_tree_for_screen_reader, above. |
| 161 bool prune_tree_for_screen_reader_; |
| 162 |
148 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerAndroid); | 163 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerAndroid); |
149 }; | 164 }; |
150 | 165 |
151 bool RegisterBrowserAccessibilityManager(JNIEnv* env); | 166 bool RegisterBrowserAccessibilityManager(JNIEnv* env); |
152 | 167 |
153 } | 168 } |
154 | 169 |
155 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H
_ | 170 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H
_ |
OLD | NEW |