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

Side by Side Diff: content/browser/accessibility/browser_accessibility_manager_android.h

Issue 290633002: Implement Android accessible hit testing using an IPC to the renderer process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@better_logging_2
Patch Set: Tweak to algorithm to find highest leaf ancestor Created 6 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 unified diff | Download patch
OLDNEW
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 25 matching lines...) Expand all
36 virtual void NotifyAccessibilityEvent( 36 virtual void NotifyAccessibilityEvent(
37 ui::AXEvent event_type, BrowserAccessibility* node) OVERRIDE; 37 ui::AXEvent event_type, BrowserAccessibility* node) OVERRIDE;
38 38
39 // -------------------------------------------------------------------------- 39 // --------------------------------------------------------------------------
40 // Methods called from Java via JNI 40 // Methods called from Java via JNI
41 // -------------------------------------------------------------------------- 41 // --------------------------------------------------------------------------
42 42
43 // Tree methods. 43 // Tree methods.
44 jint GetRootId(JNIEnv* env, jobject obj); 44 jint GetRootId(JNIEnv* env, jobject obj);
45 jboolean IsNodeValid(JNIEnv* env, jobject obj, jint id); 45 jboolean IsNodeValid(JNIEnv* env, jobject obj, jint id);
46 jint HitTest(JNIEnv* env, jobject obj, jint x, jint y); 46 void HitTest(JNIEnv* env, jobject obj, jint x, jint y);
47 47
48 // Populate Java accessibility data structures with info about a node. 48 // Populate Java accessibility data structures with info about a node.
49 jboolean PopulateAccessibilityNodeInfo( 49 jboolean PopulateAccessibilityNodeInfo(
50 JNIEnv* env, jobject obj, jobject info, jint id); 50 JNIEnv* env, jobject obj, jobject info, jint id);
51 jboolean PopulateAccessibilityEvent( 51 jboolean PopulateAccessibilityEvent(
52 JNIEnv* env, jobject obj, jobject event, jint id, jint event_type); 52 JNIEnv* env, jobject obj, jobject event, jint id, jint event_type);
53 53
54 // Perform actions. 54 // Perform actions.
55 void Click(JNIEnv* env, jobject obj, jint id); 55 void Click(JNIEnv* env, jobject obj, jint id);
56 void Focus(JNIEnv* env, jobject obj, jint id); 56 void Focus(JNIEnv* env, jobject obj, jint id);
(...skipping 19 matching lines...) Expand all
76 // constructor. 76 // constructor.
77 friend class BrowserAccessibilityManager; 77 friend class BrowserAccessibilityManager;
78 78
79 // A weak reference to the Java BrowserAccessibilityManager object. 79 // A weak reference to the Java BrowserAccessibilityManager object.
80 // This avoids adding another reference to BrowserAccessibilityManager and 80 // This avoids adding another reference to BrowserAccessibilityManager and
81 // preventing garbage collection. 81 // preventing garbage collection.
82 // Premature garbage collection is prevented by the long-lived reference in 82 // Premature garbage collection is prevented by the long-lived reference in
83 // ContentViewCore. 83 // ContentViewCore.
84 JavaObjectWeakGlobalRef java_ref_; 84 JavaObjectWeakGlobalRef java_ref_;
85 85
86 // Searches through the children of start_node to find the nearest 86 // Handle a hover event from the renderer process.
87 // accessibility focus candidate for a touch which has not landed directly on 87 void HandleHoverEvent(BrowserAccessibility* node);
88 // an accessibility focus candidate.
89 BrowserAccessibility* FuzzyHitTest(
90 int x, int y, BrowserAccessibility* start_node);
91
92 static void FuzzyHitTestImpl(int x, int y, BrowserAccessibility* start_node,
93 BrowserAccessibility** nearest_candidate, int* min_distance);
94
95 // Calculates the distance from the point (x, y) to the nearest point on the
96 // edge of |node|.
97 static int CalculateDistanceSquared(int x, int y, BrowserAccessibility* node);
98 88
99 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerAndroid); 89 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityManagerAndroid);
100 }; 90 };
101 91
102 bool RegisterBrowserAccessibilityManager(JNIEnv* env); 92 bool RegisterBrowserAccessibilityManager(JNIEnv* env);
103 93
104 } 94 }
105 95
106 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H _ 96 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_MANAGER_ANDROID_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698