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