Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

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

Issue 3562011: Revert 61740 - Make BrowserAccessibilityManager cross platform. Step 2. ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | 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
13 #include "base/basictypes.h" 9 #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;
23 10
24 //////////////////////////////////////////////////////////////////////////////// 11 ////////////////////////////////////////////////////////////////////////////////
25 // 12 //
26 // BrowserAccessibility 13 // BrowserAccessibility
27 // 14 //
28 // Class implementing the cross platform interface for the Browser-Renderer 15 // Class implementing the cross platform interface for the Browser-Renderer
29 // communication of accessibility information, providing accessibility 16 // communication of accessibility information, providing accessibility
30 // to be used by screen readers and other assistive technology (AT). 17 // to be used by screen readers and other assistive technology (AT).
31 // 18 //
32 // An implementation for each platform handles platform specific accessibility 19 // An implementation for each platform handles platform specific accessibility
33 // APIs. 20 // APIs.
34 // 21 //
35 //////////////////////////////////////////////////////////////////////////////// 22 ////////////////////////////////////////////////////////////////////////////////
36 class BrowserAccessibility { 23 class BrowserAccessibility {
37 public: 24 public:
38 // Creates a platform specific BrowserAccessibility. Ownership passes to the 25 // Creates the platform specific BrowserAccessibility. Ownership passes to the
39 // caller. 26 // caller.
40 static BrowserAccessibility* Create();
41
42 virtual ~BrowserAccessibility(); 27 virtual ~BrowserAccessibility();
43 28
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
104 protected: 29 protected:
105 BrowserAccessibility(); 30 BrowserAccessibility();
106 31
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
136 private: 32 private:
137 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 33 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
138 }; 34 };
139 35
140 #endif // CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_H_ 36 #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
This is Rietveld 408576698