Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Unified Diff: content/browser/accessibility/browser_accessibility_manager_android.h

Issue 15741009: Native Android accessibility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698