OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 13 matching lines...) Expand all Loading... |
24 namespace content { | 24 namespace content { |
25 class BrowserAccessibilityManager; | 25 class BrowserAccessibilityManager; |
26 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
27 class BrowserAccessibilityWin; | 27 class BrowserAccessibilityWin; |
28 #endif | 28 #endif |
29 | 29 |
30 //////////////////////////////////////////////////////////////////////////////// | 30 //////////////////////////////////////////////////////////////////////////////// |
31 // | 31 // |
32 // BrowserAccessibility | 32 // BrowserAccessibility |
33 // | 33 // |
34 // A BrowserAccessibility object represents one node in the accessibility | 34 // Class implementing the cross platform interface for the Browser-Renderer |
35 // tree on the browser side. It exactly corresponds to one WebAXObject from | 35 // communication of accessibility information, providing accessibility |
36 // Blink. It's owned by a BrowserAccessibilityManager. | 36 // to be used by screen readers and other assistive technology (AT). |
37 // | 37 // |
38 // There are subclasses of BrowserAccessibility for each platform where | 38 // An implementation for each platform handles platform specific accessibility |
39 // we implement native accessibility APIs. This base class is used occasionally | 39 // APIs. |
40 // for tests. | |
41 // | 40 // |
42 //////////////////////////////////////////////////////////////////////////////// | 41 //////////////////////////////////////////////////////////////////////////////// |
43 class CONTENT_EXPORT BrowserAccessibility { | 42 class CONTENT_EXPORT BrowserAccessibility { |
44 public: | 43 public: |
45 // Creates a platform specific BrowserAccessibility. Ownership passes to the | 44 // Creates a platform specific BrowserAccessibility. Ownership passes to the |
46 // caller. | 45 // caller. |
47 static BrowserAccessibility* Create(); | 46 static BrowserAccessibility* Create(); |
48 | 47 |
49 virtual ~BrowserAccessibility(); | 48 virtual ~BrowserAccessibility(); |
50 | 49 |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 238 |
240 // Returns true if the bit corresponding to the given state enum is 1. | 239 // Returns true if the bit corresponding to the given state enum is 1. |
241 bool HasState(ui::AXState state_enum) const; | 240 bool HasState(ui::AXState state_enum) const; |
242 | 241 |
243 // Returns true if this node is an editable text field of any kind. | 242 // Returns true if this node is an editable text field of any kind. |
244 bool IsEditableText() const; | 243 bool IsEditableText() const; |
245 | 244 |
246 // Append the text from this node and its children. | 245 // Append the text from this node and its children. |
247 std::string GetTextRecursive() const; | 246 std::string GetTextRecursive() const; |
248 | 247 |
249 // Identifies the given frame tree node id as the only child of this node, | |
250 // so any call to PlatformChildCount/PlatformGetChild will use | |
251 // BrowserAccessibilityDelegate::AccessibilityGetChildFrame to retrieve | |
252 // the BrowserAccessibilityManager of the child frame and return its root | |
253 // node as this node's child. | |
254 void SetChildFrameTreeNodeId(int64 child_frame_tree_node_id); | |
255 | |
256 int64 child_frame_tree_node_id() const { return child_frame_tree_node_id_; } | |
257 | |
258 protected: | 248 protected: |
259 BrowserAccessibility(); | 249 BrowserAccessibility(); |
260 | 250 |
261 // The manager of this tree of accessibility objects. | 251 // The manager of this tree of accessibility objects. |
262 BrowserAccessibilityManager* manager_; | 252 BrowserAccessibilityManager* manager_; |
263 | 253 |
264 // The underlying node. | 254 // The underlying node. |
265 ui::AXNode* node_; | 255 ui::AXNode* node_; |
266 | 256 |
267 private: | 257 private: |
268 // Return the sum of the lengths of all static text descendants, | 258 // Return the sum of the lengths of all static text descendants, |
269 // including this object if it's static text. | 259 // including this object if it's static text. |
270 int GetStaticTextLenRecursive() const; | 260 int GetStaticTextLenRecursive() const; |
271 | 261 |
272 std::string name_; | 262 std::string name_; |
273 std::string value_; | 263 std::string value_; |
274 | 264 |
275 // If nonzero, the frame tree node id of the child frame of this node. | 265 private: |
276 int64 child_frame_tree_node_id_; | |
277 | |
278 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); | 266 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); |
279 }; | 267 }; |
280 | 268 |
281 } // namespace content | 269 } // namespace content |
282 | 270 |
283 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ | 271 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ |
OLD | NEW |