Index: content/browser/accessibility/browser_accessibility_manager_android.h |
diff --git a/content/browser/accessibility/browser_accessibility_manager_android.h b/content/browser/accessibility/browser_accessibility_manager_android.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e9b982e035c927a15d77866f3ac93b15311747ec |
--- /dev/null |
+++ b/content/browser/accessibility/browser_accessibility_manager_android.h |
@@ -0,0 +1,82 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H_ |
+#define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H_ |
+ |
+#include "base/android/scoped_java_ref.h" |
+#include "content/browser/accessibility/browser_accessibility_manager.h" |
+#include "content/browser/android/content_view_core_impl.h" |
+ |
+namespace content { |
+ |
+namespace aria_strings { |
+ extern const char kAriaLivePolite[]; |
+ extern const char kAriaLiveAssertive[]; |
+} |
+ |
+class CONTENT_EXPORT BrowserAccessibilityManagerAndroid |
+ : public BrowserAccessibilityManager { |
+ public: |
+ BrowserAccessibilityManagerAndroid( |
+ ContentViewCoreImpl* content_view_core, |
+ const AccessibilityNodeData& src, |
+ BrowserAccessibilityDelegate* delegate, |
+ BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); |
+ |
+ virtual ~BrowserAccessibilityManagerAndroid(); |
+ |
+ static AccessibilityNodeData GetEmptyDocument(); |
+ |
+ // Implementation of BrowserAccessibilityManager. |
+ virtual void NotifyAccessibilityEvent(int type, |
+ BrowserAccessibility* node) OVERRIDE; |
+ |
+ ContentViewCoreImpl* content_view_core() { return content_view_core_; } |
+ |
+ // -------------------------------------------------------------------------- |
+ // Methods called from Java via JNI |
+ // -------------------------------------------------------------------------- |
+ |
+ // Tree methods. |
+ jint GetRootId(JNIEnv* env, jobject obj); |
+ jint HitTest(JNIEnv* env, jobject obj, jint x, jint y); |
+ |
+ // Gets a temporary pointer to a specific node, only valid in this scope. |
+ // May return 0 if that node id is no longer valid. |
+ jint GetNativeNodeById(JNIEnv* env, jobject obj, jint id); |
+ |
+ protected: |
+ virtual void NotifyRootChanged() OVERRIDE; |
+ |
+ virtual bool UseRootScrollOffsetsWhenComputingBounds() OVERRIDE; |
+ |
+ private: |
+ // This gives BrowserAccessibilityManager::Create access to the class |
+ // constructor. |
+ friend class BrowserAccessibilityManager; |
+ |
+ ContentViewCoreImpl* content_view_core_; |
+ base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
+ |
+ // Searches through the children of start_node to find the nearest |
+ // accessibility focus candidate for a touch which has not landed directly on |
+ // an accessibility focus candidate. |
+ BrowserAccessibility* FuzzyHitTest( |
+ int x, int y, BrowserAccessibility* start_node); |
+ void FuzzyHitTestImpl(int x, int y, BrowserAccessibility* start_node, |
+ BrowserAccessibility** nearest_candidate, float* min_distance); |
+ |
+ // Calculates the distance from the point (x, y) to the nearest point on the |
+ // edge of |node|. |
+ static float CalculateDistance(int x, int y, BrowserAccessibility* node); |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerAndroid); |
+}; |
+ |
+bool RegisterBrowserAccessibilityManager(JNIEnv* env); |
+ |
+} |
+ |
+#endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H_ |