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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_ANDROID_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_ANDROID_H_
8 #include "base/android/scoped_java_ref.h"
9 #include "content/browser/accessibility/browser_accessibility.h"
13 class CONTENT_EXPORT BrowserAccessibilityAndroid
: public BrowserAccessibility
{
15 // Overrides from BrowserAccessibility.
16 void OnDataChanged() override
;
17 bool IsNative() const override
;
18 void OnLocationChanged() override
;
20 bool PlatformIsLeaf() const override
;
22 bool IsCheckable() const;
23 bool IsChecked() const;
24 bool IsClickable() const;
25 bool IsCollection() const;
26 bool IsCollectionItem() const;
27 bool IsContentInvalid() const;
28 bool IsDismissable() const;
29 bool IsEditableText() const;
30 bool IsEnabled() const;
31 bool IsFocusable() const;
32 bool IsFocused() const;
33 bool IsHeading() const;
34 bool IsHierarchical() const;
36 bool IsMultiLine() const;
37 bool IsPassword() const;
38 bool IsRangeType() const;
39 bool IsScrollable() const;
40 bool IsSelected() const;
41 bool IsSlider() const;
42 bool IsVisibleToUser() const;
44 bool CanOpenPopup() const;
46 bool HasFocusableChild() const;
48 const char* GetClassName() const;
49 base::string16
GetText() const;
51 int GetItemIndex() const;
52 int GetItemCount() const;
54 bool CanScrollForward() const;
55 bool CanScrollBackward() const;
56 bool CanScrollUp() const;
57 bool CanScrollDown() const;
58 bool CanScrollLeft() const;
59 bool CanScrollRight() const;
60 int GetScrollX() const;
61 int GetScrollY() const;
62 int GetMinScrollX() const;
63 int GetMinScrollY() const;
64 int GetMaxScrollX() const;
65 int GetMaxScrollY() const;
66 bool Scroll(int direction
) const;
68 int GetTextChangeFromIndex() const;
69 int GetTextChangeAddedCount() const;
70 int GetTextChangeRemovedCount() const;
71 base::string16
GetTextChangeBeforeText() const;
73 int GetSelectionStart() const;
74 int GetSelectionEnd() const;
75 int GetEditableTextLength() const;
77 int AndroidInputType() const;
78 int AndroidLiveRegionType() const;
79 int AndroidRangeType() const;
82 int ColumnCount() const;
86 int ColumnIndex() const;
87 int ColumnSpan() const;
89 float RangeMin() const;
90 float RangeMax() const;
91 float RangeCurrentValue() const;
93 // Calls GetLineBoundaries or GetWordBoundaries depending on the value
94 // of |granularity|, or fails if anything else is passed in |granularity|.
95 void GetGranularityBoundaries(int granularity
,
96 std::vector
<int32
>* starts
,
97 std::vector
<int32
>* ends
,
100 // Append line start and end indices for the text of this node
101 // (as returned by GetText()), adding |offset| to each one.
102 void GetLineBoundaries(std::vector
<int32
>* line_starts
,
103 std::vector
<int32
>* line_ends
,
106 // Append word start and end indices for the text of this node
107 // (as returned by GetText()) to |word_starts| and |word_ends|,
108 // adding |offset| to each one.
109 void GetWordBoundaries(std::vector
<int32
>* word_starts
,
110 std::vector
<int32
>* word_ends
,
114 // This gives BrowserAccessibility::Create access to the class constructor.
115 friend class BrowserAccessibility
;
117 BrowserAccessibilityAndroid();
119 bool HasOnlyStaticTextChildren() const;
120 bool HasOnlyTextAndImageChildren() const;
121 bool IsIframe() const;
123 void NotifyLiveRegionUpdate(base::string16
& aria_live
);
125 int CountChildrenWithRole(ui::AXRole role
) const;
127 static size_t CommonPrefixLength(const base::string16 a
,
128 const base::string16 b
);
129 static size_t CommonSuffixLength(const base::string16 a
,
130 const base::string16 b
);
131 static size_t CommonEndLengths(const base::string16 a
,
132 const base::string16 b
);
134 base::string16 cached_text_
;
136 base::string16 old_value_
;
137 base::string16 new_value_
;
139 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityAndroid
);
142 } // namespace content
144 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_ANDROID_H_