| OLD | NEW |
| 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_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_ANDROID_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_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.h" | 9 #include "content/browser/accessibility/browser_accessibility.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 class BrowserAccessibilityAndroid : public BrowserAccessibility { | 13 class BrowserAccessibilityAndroid : public BrowserAccessibility { |
| 14 public: | 14 public: |
| 15 // Overrides from BrowserAccessibility. | 15 // Overrides from BrowserAccessibility. |
| 16 virtual void PostInitialize() OVERRIDE; | 16 virtual void PostInitialize() OVERRIDE; |
| 17 virtual bool IsNative() const OVERRIDE; | 17 virtual bool IsNative() const OVERRIDE; |
| 18 | 18 |
| 19 // -------------------------------------------------------------------------- | 19 bool IsLeaf() const; |
| 20 // Methods called from Java via JNI | |
| 21 // -------------------------------------------------------------------------- | |
| 22 | 20 |
| 23 // Actions | 21 bool IsCheckable() const; |
| 24 void FocusJNI(JNIEnv* env, jobject obj); | 22 bool IsChecked() const; |
| 25 void ClickJNI(JNIEnv* env, jobject obj); | 23 bool IsClickable() const; |
| 24 bool IsEnabled() const; |
| 25 bool IsFocusable() const; |
| 26 bool IsFocused() const; |
| 27 bool IsPassword() const; |
| 28 bool IsScrollable() const; |
| 29 bool IsSelected() const; |
| 30 bool IsVisibleToUser() const; |
| 26 | 31 |
| 27 // Const accessors | 32 const char* GetClassName() const; |
| 28 jboolean GetClickableJNI(JNIEnv* env, jobject obj) const; | 33 string16 GetText() const; |
| 29 jboolean IsFocusedJNI(JNIEnv* env, jobject obj) const; | 34 |
| 30 jboolean IsEditableTextJNI(JNIEnv* env, jobject obj) const; | 35 int GetItemIndex() const; |
| 31 base::android::ScopedJavaLocalRef<jstring> GetNameJNI( | 36 int GetItemCount() const; |
| 32 JNIEnv* env, jobject obj) const; | 37 |
| 33 base::android::ScopedJavaLocalRef<jobject> GetAbsoluteRectJNI( | 38 int GetScrollX() const; |
| 34 JNIEnv* env, jobject obj) const; | 39 int GetScrollY() const; |
| 35 base::android::ScopedJavaLocalRef<jobject> GetRectInParentJNI( | 40 int GetMaxScrollX() const; |
| 36 JNIEnv* env, jobject obj) const; | 41 int GetMaxScrollY() const; |
| 37 jboolean IsFocusableJNI(JNIEnv* env, jobject obj) const; | 42 |
| 38 jint GetParentJNI(JNIEnv* env, jobject obj) const; | 43 int GetTextChangeFromIndex() const; |
| 39 jint GetChildCountJNI(JNIEnv* env, jobject obj) const; | 44 int GetTextChangeAddedCount() const; |
| 40 jint GetChildIdAtJNI( | 45 int GetTextChangeRemovedCount() const; |
| 41 JNIEnv* env, jobject obj, jint child_index) const; | 46 string16 GetTextChangeBeforeText() const; |
| 42 jboolean IsCheckableJNI(JNIEnv* env, jobject obj) const; | 47 |
| 43 jboolean IsCheckedJNI(JNIEnv* env, jobject obj) const; | 48 int GetSelectionStart() const; |
| 44 base::android::ScopedJavaLocalRef<jstring> GetClassNameJNI( | 49 int GetSelectionEnd() const; |
| 45 JNIEnv* env, jobject obj) const; | 50 int GetEditableTextLength() const; |
| 46 jboolean IsEnabledJNI(JNIEnv* env, jobject obj) const; | |
| 47 jboolean IsPasswordJNI(JNIEnv* env, jobject obj) const; | |
| 48 jboolean IsScrollableJNI(JNIEnv* env, jobject obj) const; | |
| 49 jboolean IsSelectedJNI(JNIEnv* env, jobject obj) const; | |
| 50 jboolean IsVisibleJNI(JNIEnv* env, jobject obj) const; | |
| 51 jint GetItemIndexJNI(JNIEnv* env, jobject obj) const; | |
| 52 jint GetItemCountJNI(JNIEnv* env, jobject obj) const; | |
| 53 jint GetScrollXJNI(JNIEnv* env, jobject obj) const; | |
| 54 jint GetScrollYJNI(JNIEnv* env, jobject obj) const; | |
| 55 jint GetMaxScrollXJNI(JNIEnv* env, jobject obj) const; | |
| 56 jint GetMaxScrollYJNI(JNIEnv* env, jobject obj) const; | |
| 57 base::android::ScopedJavaLocalRef<jstring> GetAriaLiveJNI( | |
| 58 JNIEnv* env, jobject obj) const; | |
| 59 jint GetSelectionStartJNI(JNIEnv* env, jobject obj) const; | |
| 60 jint GetSelectionEndJNI(JNIEnv* env, jobject obj) const; | |
| 61 jint GetEditableTextLengthJNI(JNIEnv* env, jobject obj) const; | |
| 62 jint GetTextChangeFromIndexJNI(JNIEnv* env, jobject obj) const; | |
| 63 jint GetTextChangeAddedCountJNI(JNIEnv* env, jobject obj) const; | |
| 64 jint GetTextChangeRemovedCountJNI(JNIEnv* env, jobject obj) const; | |
| 65 base::android::ScopedJavaLocalRef<jstring> GetTextChangeBeforeTextJNI( | |
| 66 JNIEnv* env, jobject obj) const; | |
| 67 | 51 |
| 68 private: | 52 private: |
| 69 // This gives BrowserAccessibility::Create access to the class constructor. | 53 // This gives BrowserAccessibility::Create access to the class constructor. |
| 70 friend class BrowserAccessibility; | 54 friend class BrowserAccessibility; |
| 71 | 55 |
| 72 // Allow BrowserAccessibilityManagerAndroid to call these private methods. | |
| 73 friend class BrowserAccessibilityManagerAndroid; | |
| 74 | |
| 75 BrowserAccessibilityAndroid(); | 56 BrowserAccessibilityAndroid(); |
| 76 | 57 |
| 77 string16 ComputeName() const; | |
| 78 string16 GetAriaLive() const; | |
| 79 bool IsFocusable() const; | |
| 80 bool HasFocusableChild() const; | 58 bool HasFocusableChild() const; |
| 81 bool HasOnlyStaticTextChildren() const; | 59 bool HasOnlyStaticTextChildren() const; |
| 82 bool IsIframe() const; | 60 bool IsIframe() const; |
| 83 bool IsLeaf() const; | |
| 84 | 61 |
| 85 void NotifyLiveRegionUpdate(string16& aria_live); | 62 void NotifyLiveRegionUpdate(string16& aria_live); |
| 86 | 63 |
| 87 string16 cached_text_; | 64 string16 cached_text_; |
| 88 bool first_time_; | 65 bool first_time_; |
| 89 string16 old_value_; | 66 string16 old_value_; |
| 90 string16 new_value_; | 67 string16 new_value_; |
| 91 | 68 |
| 92 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityAndroid); | 69 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityAndroid); |
| 93 }; | 70 }; |
| 94 | 71 |
| 95 bool RegisterBrowserAccessibility(JNIEnv* env); | |
| 96 | |
| 97 } // namespace content | 72 } // namespace content |
| 98 | 73 |
| 99 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_ANDROID_H_ | 74 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_ANDROID_H_ |
| OLD | NEW |