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

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

Issue 115374: Adds propagation and handling of render-side focus events, for the benefit of... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_BROWSER_ACCESSIBILITY_H_ 5 #ifndef CHROME_BROWSER_BROWSER_ACCESSIBILITY_H_
6 #define CHROME_BROWSER_BROWSER_ACCESSIBILITY_H_ 6 #define CHROME_BROWSER_BROWSER_ACCESSIBILITY_H_
7 7
8 #include <atlbase.h> 8 #include <atlbase.h>
9 #include <atlcom.h> 9 #include <atlcom.h>
10 10
11 #include <oleacc.h> 11 #include <oleacc.h>
12 12
13 #include "base/basictypes.h"
14 #include "webkit/glue/webaccessibility.h" 13 #include "webkit/glue/webaccessibility.h"
15 14
16 using webkit_glue::WebAccessibility; 15 using webkit_glue::WebAccessibility;
17 16
18 //////////////////////////////////////////////////////////////////////////////// 17 ////////////////////////////////////////////////////////////////////////////////
19 // 18 //
20 // BrowserAccessibility 19 // BrowserAccessibility
21 // 20 //
22 // Class implementing the MSAA IAccessible COM interface for the 21 // Class implementing the MSAA IAccessible COM interface for the
23 // Browser-Renderer communication of MSAA information, providing accessibility 22 // Browser-Renderer communication of MSAA information, providing accessibility
24 // to be used by screen readers and other assistive technology (AT). 23 // to be used by screen readers and other assistive technology (AT).
25 // 24 //
26 //////////////////////////////////////////////////////////////////////////////// 25 ////////////////////////////////////////////////////////////////////////////////
27 class ATL_NO_VTABLE BrowserAccessibility 26 class ATL_NO_VTABLE BrowserAccessibility
28 : public CComObjectRootEx<CComMultiThreadModel>, 27 : public CComObjectRootEx<CComMultiThreadModel>,
29 public IDispatchImpl<IAccessible, &IID_IAccessible, &LIBID_Accessibility> { 28 public IDispatchImpl<IAccessible, &IID_IAccessible, &LIBID_Accessibility> {
30 public: 29 public:
31 BEGIN_COM_MAP(BrowserAccessibility) 30 BEGIN_COM_MAP(BrowserAccessibility)
32 COM_INTERFACE_ENTRY2(IDispatch, IAccessible) 31 COM_INTERFACE_ENTRY2(IDispatch, IAccessible)
33 COM_INTERFACE_ENTRY(IAccessible) 32 COM_INTERFACE_ENTRY(IAccessible)
34 END_COM_MAP() 33 END_COM_MAP()
35 34
36 BrowserAccessibility(); 35 BrowserAccessibility() {}
37 ~BrowserAccessibility() {} 36 ~BrowserAccessibility() {}
38 37
38 HRESULT Initialize(int iaccessible_id,
39 int routing_id,
40 int process_id,
41 HWND parent_hwnd);
42
39 // Supported IAccessible methods. 43 // Supported IAccessible methods.
40 44
41 // Performs the default action on a given object. 45 // Performs the default action on a given object.
42 STDMETHODIMP accDoDefaultAction(VARIANT var_id); 46 STDMETHODIMP accDoDefaultAction(VARIANT var_id);
43 47
44 // Retrieves the child element or child object at a given point on the screen. 48 // Retrieves the child element or child object at a given point on the screen.
45 STDMETHODIMP accHitTest(LONG x_left, LONG y_top, VARIANT* child); 49 STDMETHODIMP accHitTest(LONG x_left, LONG y_top, VARIANT* child);
46 50
47 // Retrieves the specified object's current screen location. 51 // Retrieves the specified object's current screen location.
48 STDMETHODIMP accLocation(LONG* x_left, 52 STDMETHODIMP accLocation(LONG* x_left,
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Retrieves information describing the role of the specified object. 88 // Retrieves information describing the role of the specified object.
85 STDMETHODIMP get_accRole(VARIANT var_id, VARIANT* role); 89 STDMETHODIMP get_accRole(VARIANT var_id, VARIANT* role);
86 90
87 // Retrieves the current state of the specified object. 91 // Retrieves the current state of the specified object.
88 STDMETHODIMP get_accState(VARIANT var_id, VARIANT* state); 92 STDMETHODIMP get_accState(VARIANT var_id, VARIANT* state);
89 93
90 // Returns the value associated with the object. 94 // Returns the value associated with the object.
91 STDMETHODIMP get_accValue(VARIANT var_id, BSTR* value); 95 STDMETHODIMP get_accValue(VARIANT var_id, BSTR* value);
92 96
93 // Non-supported (by WebKit) IAccessible methods. 97 // Non-supported (by WebKit) IAccessible methods.
94 STDMETHODIMP accSelect(LONG flags_sel, VARIANT var_id); 98 STDMETHODIMP accSelect(LONG flags_sel, VARIANT var_id) { return E_NOTIMPL; }
95 99
96 STDMETHODIMP get_accHelpTopic(BSTR* help_file, 100 STDMETHODIMP get_accHelpTopic(BSTR* help_file,
97 VARIANT var_id, 101 VARIANT var_id,
98 LONG* topic_id); 102 LONG* topic_id);
99 103
100 STDMETHODIMP get_accSelection(VARIANT* selected); 104 STDMETHODIMP get_accSelection(VARIANT* selected);
101 105
102 // Deprecated functions, not implemented here. 106 // Deprecated functions, not implemented here.
103 STDMETHODIMP put_accName(VARIANT var_id, BSTR put_name); 107 STDMETHODIMP put_accName(VARIANT var_id, BSTR put_name) { return E_NOTIMPL; }
104 STDMETHODIMP put_accValue(VARIANT var_id, BSTR put_val); 108 STDMETHODIMP put_accValue(VARIANT var_id, BSTR put_val) { return E_NOTIMPL; }
105 109
106 // Modify/retrieve the unique id of this IAccessible instance. 110 // Accessors/mutators.
107 void set_iaccessible_id(int iaccessible_id) { 111 HWND parent_hwnd() const { return parent_hwnd_;}
108 iaccessible_id_ = iaccessible_id;
109 }
110 int iaccessible_id() const { return iaccessible_id_; }
111
112 // Modify/retrieve the unique id of this IAccessible's routing variables.
113 void set_instance_id(int instance_id) {
114 instance_id_ = instance_id;
115 }
116 int instance_id() const { return instance_id_; }
117 112
118 // Modify/retrieve the state (active/inactive) of this instance. 113 // Modify/retrieve the state (active/inactive) of this instance.
119 void set_instance_active(bool instance_active) { 114 void set_instance_active(bool instance_active) {
120 instance_active_ = instance_active; 115 instance_active_ = instance_active;
121 } 116 }
122 int instance_active() const { return instance_active_; } 117 int instance_active() const { return instance_active_; }
123 118
119 void set_direct_descendant(bool direct_descendant) {
120 direct_descendant_ = direct_descendant;
121 }
122 bool direct_descendant() const { return direct_descendant_; }
123
124 int routing_id() const { return routing_id_; }
125
124 private: 126 private:
125 // Creates an empty VARIANT. Used as the equivalent of a NULL (unused) input 127 // Creates an empty VARIANT. Used as the equivalent of a NULL (unused) input
126 // parameter. 128 // parameter.
127 VARIANT EmptyVariant() const { 129 VARIANT EmptyVariant() const {
128 VARIANT empty; 130 VARIANT empty;
129 empty.vt = VT_EMPTY; 131 empty.vt = VT_EMPTY;
130 return empty; 132 return empty;
131 } 133 }
132 134
133 // Wrapper functions, calling through to singleton instance of 135 // Wrapper functions, calling through to singleton instance of
134 // BrowserAccessibilityManager. 136 // BrowserAccessibilityManager.
135 137
136 // Creates an instance of BrowserAccessibility, initializes it and sets the 138 // Creates an instance of BrowserAccessibility, initializes it and sets the
137 // [iaccessible_id] and [parent_id]. 139 // [iaccessible_id] and [parent_id].
138 STDMETHODIMP CreateInstance(REFIID iid, 140 STDMETHODIMP CreateInstance(REFIID iid,
139 int iaccessible_id, 141 int iaccessible_id,
140 void** interface_ptr); 142 void** interface_ptr);
141 143
142 // Composes and sends a message for requesting needed accessibility 144 // Composes and sends a message for requesting needed accessibility
143 // information. Unused LONG input parameters should be NULL, and the VARIANT 145 // information. Unused LONG input parameters should be NULL, and the VARIANT
144 // an empty, valid instance. 146 // an empty, valid instance.
145 bool RequestAccessibilityInfo(int iaccessible_func_id, 147 bool RequestAccessibilityInfo(int iaccessible_func_id,
146 VARIANT var_id, 148 VARIANT var_id,
147 LONG input1, LONG input2); 149 LONG input1, LONG input2);
148 150
149 // Accessors. 151 // Accessors.
150 const WebAccessibility::OutParams& response(); 152 const WebAccessibility::OutParams& response();
151 HWND parent_hwnd();
152 153
153 // Returns a conversion from the BrowserAccessibilityRole (as defined in 154 // Returns a conversion from the BrowserAccessibilityRole (as defined in
154 // webkit/glue/webaccessibility.h) to an MSAA role. 155 // webkit/glue/webaccessibility.h) to an MSAA role.
155 long MSAARole(long browser_accessibility_role); 156 long MSAARole(long browser_accessibility_role);
156 157
157 // Returns a conversion from the BrowserAccessibilityState (as defined in 158 // Returns a conversion from the BrowserAccessibilityState (as defined in
158 // webkit/glue/webaccessibility.h) to MSAA states set. 159 // webkit/glue/webaccessibility.h) to MSAA states set.
159 long MSAAState(long browser_accessibility_state); 160 long MSAAState(long browser_accessibility_state);
160 161
161 // Id to uniquely distinguish this instance in the render-side caching, 162 // Id to uniquely distinguish this instance in the render-side caching,
162 // mapping it to the correct IAccessible on that side. Initialized to -1. 163 // mapping it to the correct IAccessible on that side. Initialized to -1.
163 int iaccessible_id_; 164 int iaccessible_id_;
164 165
165 // The unique id of this IAccessible instance. Used to help 166 // The unique ids of this IAccessible instance. Used to help
166 // BrowserAccessibilityManager instance retrieve the correct member 167 // BrowserAccessibilityManager instance retrieve the correct member
167 // variables for this process. 168 // variables for this process.
168 int instance_id_; 169 int routing_id_;
170 int process_id_;
171
172 HWND parent_hwnd_;
173
174 // Indicates if an incoming request for child information relates to a child
175 // id of a direct child of the BrowserAccessibility object, or if it refers
176 // to an object elsewhere in the MSAA tree. Set by BrowserAccessibilityManager
177 // and applicable only to the root BrowserAccessibility object (id 0). Needed
178 // to properly handled MSAA focus events, where the child id is the only
179 // parameter in our control.
180 bool direct_descendant_;
169 181
170 // The instance should only be active if there is a non-terminated 182 // The instance should only be active if there is a non-terminated
171 // RenderProcessHost associated with it. The BrowserAccessibilityManager keeps 183 // RenderProcessHost associated with it. The BrowserAccessibilityManager keeps
172 // track of this state, and sets it to false to disable all calls into the 184 // track of this state, and sets it to false to disable all calls into the
173 // renderer from this instance of BroweserAccessibility, and have all 185 // renderer from this instance of BroweserAccessibility, and have all
174 // IAccessible functions return E_FAIL. 186 // IAccessible functions return E_FAIL.
175 bool instance_active_; 187 bool instance_active_;
176 188
177 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility); 189 DISALLOW_COPY_AND_ASSIGN(BrowserAccessibility);
178 }; 190 };
179 #endif // CHROME_BROWSER_BROWSER_ACCESSIBILITY_H_ 191 #endif // CHROME_BROWSER_BROWSER_ACCESSIBILITY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_accessibility.cc » ('j') | webkit/glue/webaccessibilitymanager_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698