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 CanScrollForward() const;
23 bool CanScrollBackward() const;
24 bool IsCheckable() const;
25 bool IsChecked() const;
26 bool IsClickable() const;
27 bool IsCollection() const;
28 bool IsCollectionItem() const;
29 bool IsContentInvalid() const;
30 bool IsDismissable() const;
31 bool IsEditableText() const;
32 bool IsEnabled() const;
33 bool IsFocusable() const;
34 bool IsFocused() const;
35 bool IsHeading() const;
36 bool IsHierarchical() const;
38 bool IsMultiLine() const;
39 bool IsPassword() const;
40 bool IsRangeType() const;
41 bool IsScrollable() const;
42 bool IsSelected() const;
43 bool IsSlider() const;
44 bool IsVisibleToUser() const;
46 bool CanOpenPopup() const;
48 bool HasFocusableChild() const;
50 const char* GetClassName() const;
51 base::string16
GetText() const;
53 int GetItemIndex() const;
54 int GetItemCount() const;
56 int GetScrollX() const;
57 int GetScrollY() const;
58 int GetMaxScrollX() const;
59 int GetMaxScrollY() const;
61 int GetTextChangeFromIndex() const;
62 int GetTextChangeAddedCount() const;
63 int GetTextChangeRemovedCount() const;
64 base::string16
GetTextChangeBeforeText() const;
66 int GetSelectionStart() const;
67 int GetSelectionEnd() const;
68 int GetEditableTextLength() const;
70 int AndroidInputType() const;
71 int AndroidLiveRegionType() const;
72 int AndroidRangeType() const;
75 int ColumnCount() const;
79 int ColumnIndex() const;
80 int ColumnSpan() const;
82 float RangeMin() const;
83 float RangeMax() const;
84 float RangeCurrentValue() const;
86 // Calls GetLineBoundaries or GetWordBoundaries depending on the value
87 // of |granularity|, or fails if anything else is passed in |granularity|.
88 void GetGranularityBoundaries(int granularity
,
89 std::vector
<int32
>* starts
,
90 std::vector
<int32
>* ends
,
93 // Append line start and end indices for the text of this node
94 // (as returned by GetText()), adding |offset| to each one.
95 void GetLineBoundaries(std::vector
<int32
>* line_starts
,
96 std::vector
<int32
>* line_ends
,
99 // Append word start and end indices for the text of this node
100 // (as returned by GetText()) to |word_starts| and |word_ends|,
101 // adding |offset| to each one.
102 void GetWordBoundaries(std::vector
<int32
>* word_starts
,
103 std::vector
<int32
>* word_ends
,
107 // This gives BrowserAccessibility::Create access to the class constructor.
108 friend class BrowserAccessibility
;
110 BrowserAccessibilityAndroid();
112 bool HasOnlyStaticTextChildren() const;
113 bool HasOnlyTextAndImageChildren() const;
114 bool IsIframe() const;
116 void NotifyLiveRegionUpdate(base::string16
& aria_live
);
118 int CountChildrenWithRole(ui::AXRole role
) const;
120 base::string16 cached_text_
;
122 base::string16 old_value_
;
123 base::string16 new_value_
;
125 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibilityAndroid
);
128 } // namespace content
130 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_ANDROID_H_