Chromium Code Reviews

Side by Side Diff: chrome/browser/accessibility/browser_accessibility.h

Issue 3551015: Make BrowserAccessibilityManager cross platform. Step 2. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Addressing linux (shlib dbg) and mac (clang) buildbot compile errors. Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/accessibility/browser_accessibility.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 5 #ifndef CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
6 #define CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 6 #define CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map>
10 #include <utility>
11 #include <vector>
12
9 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "build/build_config.h"
15 #include "webkit/glue/webaccessibility.h"
16
17 class BrowserAccessibilityManager;
18 #if defined(OS_WIN)
19 class BrowserAccessibilityWin;
20 #endif
21
22 using webkit_glue::WebAccessibility;
10 23
11 //////////////////////////////////////////////////////////////////////////////// 24 ////////////////////////////////////////////////////////////////////////////////
12 // 25 //
13 // BrowserAccessibility 26 // BrowserAccessibility
14 // 27 //
15 // Class implementing the cross platform interface for the Browser-Renderer 28 // Class implementing the cross platform interface for the Browser-Renderer
16 // communication of accessibility information, providing accessibility 29 // communication of accessibility information, providing accessibility
17 // to be used by screen readers and other assistive technology (AT). 30 // to be used by screen readers and other assistive technology (AT).
18 // 31 //
19 // An implementation for each platform handles platform specific accessibility 32 // An implementation for each platform handles platform specific accessibility
20 // APIs. 33 // APIs.
21 // 34 //
22 //////////////////////////////////////////////////////////////////////////////// 35 ////////////////////////////////////////////////////////////////////////////////
23 class BrowserAccessibility { 36 class BrowserAccessibility {
24 public: 37 public:
25 // Creates the platform specific BrowserAccessibility. Ownership passes to the 38 // Creates a platform specific BrowserAccessibility. Ownership passes to the
26 // caller. 39 // caller.
40 static BrowserAccessibility* Create();
41
27 virtual ~BrowserAccessibility(); 42 virtual ~BrowserAccessibility();
28 43
44 // Perform platform specific initialization. This can be called multiple times
45 // during the lifetime of this instance after the members of this base object
46 // have been reset with new values from the renderer process.
47 virtual void Initialize() = 0;
48
49 // Remove references to all children and delete them if possible.
50 virtual void ReleaseTree();
51
52 // Release a reference to this node. This may be a no-op on platforms other
53 // than windows.
54 virtual void ReleaseReference() = 0;
55
56 // Initialize this object
57 void Initialize(BrowserAccessibilityManager* manager,
58 BrowserAccessibility* parent,
59 int32 child_id,
60 int32 index_in_parent,
61 const WebAccessibility& src);
62
63 // Add a child of this object.
64 void AddChild(BrowserAccessibility* child);
65
66 // Return true if this object is equal to or a descendant of |ancestor|.
67 bool IsDescendantOf(BrowserAccessibility* ancestor);
68
69 // Returns the parent of this object, or NULL if it's the root.
70 BrowserAccessibility* GetParent();
71
72 // Returns the number of children of this object.
73 uint32 GetChildCount();
74
75 // Return a pointer to the child with the given index.
76 BrowserAccessibility* GetChild(uint32 child_index);
77
78 // Return the previous sibling of this object, or NULL if it's the first
79 // child of its parent.
80 BrowserAccessibility* GetPreviousSibling();
81
82 // Return the next sibling of this object, or NULL if it's the last child
83 // of its parent.
84 BrowserAccessibility* GetNextSibling();
85
86 // Replace a child object. Used when updating the accessibility tree.
87 void ReplaceChild(
88 const BrowserAccessibility* old_acc,
89 BrowserAccessibility* new_acc);
90
91 // Accessors
92 int32 child_id() const { return child_id_; }
93 const std::vector<BrowserAccessibility*>& children() const {
94 return children_;
95 }
96 int32 renderer_id() const { return renderer_id_; }
97 int32 index_in_parent() const { return index_in_parent_; }
98 WebKit::WebRect location() const { return location_; }
99
100 #if defined(OS_WIN)
101 BrowserAccessibilityWin* toBrowserAccessibilityWin();
102 #endif
103
29 protected: 104 protected:
30 BrowserAccessibility(); 105 BrowserAccessibility();
31 106
107 // The manager of this tree of accessibility objects; needed for
108 // global operations like focus tracking.
109 BrowserAccessibilityManager* manager_;
110
111 // The parent of this object, may be NULL if we're the root object.
112 BrowserAccessibility* parent_;
113
114 // The ID of this object; globally unique within the browser process.
115 int32 child_id_;
116
117 // The index of this within its parent object.
118 int32 index_in_parent_;
119
120 // The ID of this object in the renderer process.
121 int32 renderer_id_;
122
123 // The children of this object.
124 std::vector<BrowserAccessibility*> children_;
125
126 // Accessibility metadata from the renderer
127 string16 name_;
128 string16 value_;
129 std::map<int32, string16> attributes_;
130 std::vector<std::pair<string16, string16> > html_attributes_;
131 int32 role_;
132 int32 state_;
133 string16 role_name_;
134 WebKit::WebRect location_;
135
32 private: 136 private:
33 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 137 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
34 }; 138 };
35 139
36 #endif // CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 140 #endif // CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/accessibility/browser_accessibility.cc » ('j') | no next file with comments »

Powered by Google App Engine