OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H_ |
| 7 |
| 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "content/browser/accessibility/browser_accessibility_manager.h" |
| 10 #include "content/browser/android/content_view_core_impl.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 namespace aria_strings { |
| 15 extern const char kAriaLivePolite[]; |
| 16 extern const char kAriaLiveAssertive[]; |
| 17 } |
| 18 |
| 19 class CONTENT_EXPORT BrowserAccessibilityManagerAndroid |
| 20 : public BrowserAccessibilityManager { |
| 21 public: |
| 22 BrowserAccessibilityManagerAndroid( |
| 23 ContentViewCoreImpl* content_view_core, |
| 24 const AccessibilityNodeData& src, |
| 25 BrowserAccessibilityDelegate* delegate, |
| 26 BrowserAccessibilityFactory* factory = new BrowserAccessibilityFactory()); |
| 27 |
| 28 virtual ~BrowserAccessibilityManagerAndroid(); |
| 29 |
| 30 static AccessibilityNodeData GetEmptyDocument(); |
| 31 |
| 32 // Implementation of BrowserAccessibilityManager. |
| 33 virtual void NotifyAccessibilityEvent(int type, |
| 34 BrowserAccessibility* node) OVERRIDE; |
| 35 |
| 36 ContentViewCoreImpl* content_view_core() { return content_view_core_; } |
| 37 |
| 38 // -------------------------------------------------------------------------- |
| 39 // Methods called from Java via JNI |
| 40 // -------------------------------------------------------------------------- |
| 41 |
| 42 // Tree methods. |
| 43 jint GetRootId(JNIEnv* env, jobject obj); |
| 44 jint HitTest(JNIEnv* env, jobject obj, jint x, jint y); |
| 45 |
| 46 // Gets a temporary pointer to a specific node, only valid in this scope. |
| 47 // May return 0 if that node id is no longer valid. |
| 48 jint GetNativeNodeById(JNIEnv* env, jobject obj, jint id); |
| 49 |
| 50 protected: |
| 51 virtual void NotifyRootChanged() OVERRIDE; |
| 52 |
| 53 virtual bool UseRootScrollOffsetsWhenComputingBounds() OVERRIDE; |
| 54 |
| 55 private: |
| 56 // This gives BrowserAccessibilityManager::Create access to the class |
| 57 // constructor. |
| 58 friend class BrowserAccessibilityManager; |
| 59 |
| 60 ContentViewCoreImpl* content_view_core_; |
| 61 base::android::ScopedJavaGlobalRef<jobject> java_ref_; |
| 62 |
| 63 // Searches through the children of start_node to find the nearest |
| 64 // accessibility focus candidate for a touch which has not landed directly on |
| 65 // an accessibility focus candidate. |
| 66 BrowserAccessibility* FuzzyHitTest( |
| 67 int x, int y, BrowserAccessibility* start_node); |
| 68 void FuzzyHitTestImpl(int x, int y, BrowserAccessibility* start_node, |
| 69 BrowserAccessibility** nearest_candidate, float* min_distance); |
| 70 |
| 71 // Calculates the distance from the point (x, y) to the nearest point on the |
| 72 // edge of |node|. |
| 73 static float CalculateDistance(int x, int y, BrowserAccessibility* node); |
| 74 |
| 75 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerAndroid); |
| 76 }; |
| 77 |
| 78 bool RegisterBrowserAccessibilityManager(JNIEnv* env); |
| 79 |
| 80 } |
| 81 |
| 82 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H
_ |
OLD | NEW |