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 bool IsLeaf() const; | 19 // -------------------------------------------------------------------------- |
| 20 // Methods called from Java via JNI |
| 21 // -------------------------------------------------------------------------- |
20 | 22 |
21 bool IsCheckable() const; | 23 // Actions |
22 bool IsChecked() const; | 24 void FocusJNI(JNIEnv* env, jobject obj); |
23 bool IsClickable() const; | 25 void ClickJNI(JNIEnv* env, jobject obj); |
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; | |
31 | 26 |
32 const char* GetClassName() const; | 27 // Const accessors |
33 string16 GetText() const; | 28 jboolean GetClickableJNI(JNIEnv* env, jobject obj) const; |
34 | 29 jboolean IsFocusedJNI(JNIEnv* env, jobject obj) const; |
35 int GetItemIndex() const; | 30 jboolean IsEditableTextJNI(JNIEnv* env, jobject obj) const; |
36 int GetItemCount() const; | 31 base::android::ScopedJavaLocalRef<jstring> GetNameJNI( |
37 | 32 JNIEnv* env, jobject obj) const; |
38 int GetScrollX() const; | 33 base::android::ScopedJavaLocalRef<jobject> GetAbsoluteRectJNI( |
39 int GetScrollY() const; | 34 JNIEnv* env, jobject obj) const; |
40 int GetMaxScrollX() const; | 35 base::android::ScopedJavaLocalRef<jobject> GetRectInParentJNI( |
41 int GetMaxScrollY() const; | 36 JNIEnv* env, jobject obj) const; |
42 | 37 jboolean IsFocusableJNI(JNIEnv* env, jobject obj) const; |
43 int GetTextChangeFromIndex() const; | 38 jint GetParentJNI(JNIEnv* env, jobject obj) const; |
44 int GetTextChangeAddedCount() const; | 39 jint GetChildCountJNI(JNIEnv* env, jobject obj) const; |
45 int GetTextChangeRemovedCount() const; | 40 jint GetChildIdAtJNI( |
46 string16 GetTextChangeBeforeText() const; | 41 JNIEnv* env, jobject obj, jint child_index) const; |
47 | 42 jboolean IsCheckableJNI(JNIEnv* env, jobject obj) const; |
48 int GetSelectionStart() const; | 43 jboolean IsCheckedJNI(JNIEnv* env, jobject obj) const; |
49 int GetSelectionEnd() const; | 44 base::android::ScopedJavaLocalRef<jstring> GetClassNameJNI( |
50 int GetEditableTextLength() const; | 45 JNIEnv* env, jobject obj) 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; |
51 | 67 |
52 private: | 68 private: |
53 // This gives BrowserAccessibility::Create access to the class constructor. | 69 // This gives BrowserAccessibility::Create access to the class constructor. |
54 friend class BrowserAccessibility; | 70 friend class BrowserAccessibility; |
55 | 71 |
| 72 // Allow BrowserAccessibilityManagerAndroid to call these private methods. |
| 73 friend class BrowserAccessibilityManagerAndroid; |
| 74 |
56 BrowserAccessibilityAndroid(); | 75 BrowserAccessibilityAndroid(); |
57 | 76 |
| 77 string16 ComputeName() const; |
| 78 string16 GetAriaLive() const; |
| 79 bool IsFocusable() const; |
58 bool HasFocusableChild() const; | 80 bool HasFocusableChild() const; |
59 bool HasOnlyStaticTextChildren() const; | 81 bool HasOnlyStaticTextChildren() const; |
60 bool IsIframe() const; | 82 bool IsIframe() const; |
| 83 bool IsLeaf() const; |
61 | 84 |
62 void NotifyLiveRegionUpdate(string16& aria_live); | 85 void NotifyLiveRegionUpdate(string16& aria_live); |
63 | 86 |
64 string16 cached_text_; | 87 string16 cached_text_; |
65 bool first_time_; | 88 bool first_time_; |
66 string16 old_value_; | 89 string16 old_value_; |
67 string16 new_value_; | 90 string16 new_value_; |
68 | 91 |
69 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityAndroid); | 92 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityAndroid); |
70 }; | 93 }; |
71 | 94 |
| 95 bool RegisterBrowserAccessibility(JNIEnv* env); |
| 96 |
72 } // namespace content | 97 } // namespace content |
73 | 98 |
74 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_ANDROID_H_ | 99 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_ANDROID_H_ |
OLD | NEW |