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

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

Issue 1489453003: jni: Pass method parameters as JavaParamRef in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
index 4c69b236ccc35ec9a0af440a1fb307ae7da3fcba..669b26284b86a866e380a2d677c6625c9b4c2389 100644
--- a/content/browser/accessibility/browser_accessibility_manager_android.h
+++ b/content/browser/accessibility/browser_accessibility_manager_android.h
@@ -80,37 +80,76 @@ class CONTENT_EXPORT BrowserAccessibilityManagerAndroid
// --------------------------------------------------------------------------
// Tree methods.
- jint GetRootId(JNIEnv* env, jobject obj);
- jboolean IsNodeValid(JNIEnv* env, jobject obj, jint id);
- void HitTest(JNIEnv* env, jobject obj, jint x, jint y);
+ jint GetRootId(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
+ jboolean IsNodeValid(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id);
+ void HitTest(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint x,
+ jint y);
// Methods to get information about a specific node.
- jboolean IsEditableText(JNIEnv* env, jobject obj, jint id);
- jint GetEditableTextSelectionStart(JNIEnv* env, jobject obj, jint id);
- jint GetEditableTextSelectionEnd(JNIEnv* env, jobject obj, jint id);
+ jboolean IsEditableText(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id);
+ jint GetEditableTextSelectionStart(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id);
+ jint GetEditableTextSelectionEnd(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id);
// Populate Java accessibility data structures with info about a node.
jboolean PopulateAccessibilityNodeInfo(
- JNIEnv* env, jobject obj, jobject info, jint id);
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ const base::android::JavaParamRef<jobject>& info,
+ jint id);
jboolean PopulateAccessibilityEvent(
- JNIEnv* env, jobject obj, jobject event, jint id, jint event_type);
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ const base::android::JavaParamRef<jobject>& event,
+ jint id,
+ jint event_type);
// Perform actions.
- void Click(JNIEnv* env, jobject obj, jint id);
- void Focus(JNIEnv* env, jobject obj, jint id);
- void Blur(JNIEnv* env, jobject obj);
- void ScrollToMakeNodeVisible(JNIEnv* env, jobject obj, jint id);
- void SetTextFieldValue(JNIEnv* env, jobject obj, jint id, jstring value);
- void SetSelection(JNIEnv* env, jobject obj, jint id, jint start, jint end);
- jboolean AdjustSlider(JNIEnv* env, jobject obj, jint id, jboolean increment);
+ void Click(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id);
+ void Focus(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id);
+ void Blur(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
+ void ScrollToMakeNodeVisible(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id);
+ void SetTextFieldValue(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id,
+ const base::android::JavaParamRef<jstring>& value);
+ void SetSelection(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id,
+ jint start,
+ jint end);
+ jboolean AdjustSlider(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id,
+ jboolean increment);
// Return the id of the next node in tree order in the direction given by
// |forwards|, starting with |start_id|, that matches |element_type|,
// where |element_type| is a special uppercase string from TalkBack or
// BrailleBack indicating general categories of web content like
// "SECTION" or "CONTROL". Return 0 if not found.
- jint FindElementType(JNIEnv* env, jobject obj, jint start_id,
- jstring element_type, jboolean forwards);
+ jint FindElementType(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint start_id,
+ const base::android::JavaParamRef<jstring>& element_type,
+ jboolean forwards);
// Respond to a ACTION_[NEXT/PREVIOUS]_AT_MOVEMENT_GRANULARITY action
// and move the cursor/selection within the given node id. We keep track
@@ -119,12 +158,19 @@ class CONTENT_EXPORT BrowserAccessibilityManagerAndroid
// in Blink, too, and either way calls
// Java_BrowserAccessibilityManager_finishGranularityMove with the
// result.
- jboolean NextAtGranularity(JNIEnv* env, jobject obj,
- jint granularity, jboolean extend_selection,
- jint id, jint cursor_index);
- jboolean PreviousAtGranularity(JNIEnv* env, jobject obj,
- jint granularity, jboolean extend_selection,
- jint id, jint cursor_index);
+ jboolean NextAtGranularity(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint granularity,
+ jboolean extend_selection,
+ jint id,
+ jint cursor_index);
+ jboolean PreviousAtGranularity(
+ JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint granularity,
+ jboolean extend_selection,
+ jint id,
+ jint cursor_index);
// Helper functions to compute the next start and end index when moving
// forwards or backwards by character, word, or line. This part is
@@ -142,14 +188,21 @@ class CONTENT_EXPORT BrowserAccessibilityManagerAndroid
// Set accessibility focus. This sends a message to the renderer to
// asynchronously load inline text boxes for this node only, enabling more
// accurate movement by granularities on this node.
- void SetAccessibilityFocus(JNIEnv* env, jobject obj, jint id);
+ void SetAccessibilityFocus(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id);
// Returns true if the object is a slider.
- bool IsSlider(JNIEnv* env, jobject obj, jint id);
+ bool IsSlider(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id);
// Scrolls any scrollable container by about 80% of one page in the
// given direction.
- bool Scroll(JNIEnv* env, jobject obj, jint id, int direction);
+ bool Scroll(JNIEnv* env,
+ const base::android::JavaParamRef<jobject>& obj,
+ jint id,
+ int direction);
protected:
// AXTreeDelegate overrides.

Powered by Google App Engine
This is Rietveld 408576698