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 23 matching lines...) Expand all Loading... |
34 | 34 |
35 class CONTENT_EXPORT BrowserAccessibilityManagerAndroid | 35 class CONTENT_EXPORT BrowserAccessibilityManagerAndroid |
36 : public BrowserAccessibilityManager { | 36 : public BrowserAccessibilityManager { |
37 public: | 37 public: |
38 BrowserAccessibilityManagerAndroid( | 38 BrowserAccessibilityManagerAndroid( |
39 base::android::ScopedJavaLocalRef<jobject> content_view_core, | 39 base::android::ScopedJavaLocalRef<jobject> content_view_core, |
40 const ui::AXTreeUpdate& initial_tree, | 40 const ui::AXTreeUpdate& initial_tree, |
41 BrowserAccessibilityDelegate* delegate, | 41 BrowserAccessibilityDelegate* delegate, |
42 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); | 42 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); |
43 | 43 |
44 virtual ~BrowserAccessibilityManagerAndroid(); | 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 // Implementation of BrowserAccessibilityManager. | 51 // Implementation of BrowserAccessibilityManager. |
52 virtual void NotifyAccessibilityEvent( | 52 void NotifyAccessibilityEvent(ui::AXEvent event_type, |
53 ui::AXEvent event_type, BrowserAccessibility* node) override; | 53 BrowserAccessibility* node) override; |
54 | 54 |
55 // -------------------------------------------------------------------------- | 55 // -------------------------------------------------------------------------- |
56 // Methods called from Java via JNI | 56 // Methods called from Java via JNI |
57 // -------------------------------------------------------------------------- | 57 // -------------------------------------------------------------------------- |
58 | 58 |
59 // Tree methods. | 59 // Tree methods. |
60 jint GetRootId(JNIEnv* env, jobject obj); | 60 jint GetRootId(JNIEnv* env, jobject obj); |
61 jboolean IsNodeValid(JNIEnv* env, jobject obj, jint id); | 61 jboolean IsNodeValid(JNIEnv* env, jobject obj, jint id); |
62 void HitTest(JNIEnv* env, jobject obj, jint x, jint y); | 62 void HitTest(JNIEnv* env, jobject obj, jint x, jint y); |
63 | 63 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // asynchronously load inline text boxes for this node only, enabling more | 120 // asynchronously load inline text boxes for this node only, enabling more |
121 // accurate movement by granularities on this node. | 121 // accurate movement by granularities on this node. |
122 void SetAccessibilityFocus(JNIEnv* env, jobject obj, jint id); | 122 void SetAccessibilityFocus(JNIEnv* env, jobject obj, jint id); |
123 | 123 |
124 protected: | 124 protected: |
125 // AXTreeDelegate overrides. | 125 // AXTreeDelegate overrides. |
126 void OnAtomicUpdateFinished( | 126 void OnAtomicUpdateFinished( |
127 bool root_changed, | 127 bool root_changed, |
128 const std::vector<ui::AXTreeDelegate::Change>& changes) override; | 128 const std::vector<ui::AXTreeDelegate::Change>& changes) override; |
129 | 129 |
130 virtual bool UseRootScrollOffsetsWhenComputingBounds() override; | 130 bool UseRootScrollOffsetsWhenComputingBounds() override; |
131 | 131 |
132 private: | 132 private: |
133 // This gives BrowserAccessibilityManager::Create access to the class | 133 // This gives BrowserAccessibilityManager::Create access to the class |
134 // constructor. | 134 // constructor. |
135 friend class BrowserAccessibilityManager; | 135 friend class BrowserAccessibilityManager; |
136 | 136 |
137 // A weak reference to the Java BrowserAccessibilityManager object. | 137 // A weak reference to the Java BrowserAccessibilityManager object. |
138 // This avoids adding another reference to BrowserAccessibilityManager and | 138 // This avoids adding another reference to BrowserAccessibilityManager and |
139 // preventing garbage collection. | 139 // preventing garbage collection. |
140 // Premature garbage collection is prevented by the long-lived reference in | 140 // Premature garbage collection is prevented by the long-lived reference in |
141 // ContentViewCore. | 141 // ContentViewCore. |
142 JavaObjectWeakGlobalRef java_ref_; | 142 JavaObjectWeakGlobalRef java_ref_; |
143 | 143 |
144 // Handle a hover event from the renderer process. | 144 // Handle a hover event from the renderer process. |
145 void HandleHoverEvent(BrowserAccessibility* node); | 145 void HandleHoverEvent(BrowserAccessibility* node); |
146 | 146 |
147 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerAndroid); | 147 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerAndroid); |
148 }; | 148 }; |
149 | 149 |
150 bool RegisterBrowserAccessibilityManager(JNIEnv* env); | 150 bool RegisterBrowserAccessibilityManager(JNIEnv* env); |
151 | 151 |
152 } | 152 } |
153 | 153 |
154 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H
_ | 154 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H
_ |
OLD | NEW |