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 CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENTS_H_ | 5 #ifndef CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENTS_H_ |
6 #define CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENTS_H_ | 6 #define CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENTS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "ui/accessibility/ax_enums.h" | 10 #include "ui/accessibility/ax_enums.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 }; | 54 }; |
55 | 55 |
56 // Abstract parent class for accessibility information about a control | 56 // Abstract parent class for accessibility information about a control |
57 // passed to event listeners. | 57 // passed to event listeners. |
58 class AccessibilityControlInfo : public AccessibilityEventInfo { | 58 class AccessibilityControlInfo : public AccessibilityEventInfo { |
59 public: | 59 public: |
60 virtual ~AccessibilityControlInfo(); | 60 virtual ~AccessibilityControlInfo(); |
61 | 61 |
62 // Serialize this class as a DictionaryValue that can be converted to | 62 // Serialize this class as a DictionaryValue that can be converted to |
63 // a JavaScript object. | 63 // a JavaScript object. |
64 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; | 64 virtual void SerializeToDict(base::DictionaryValue* dict) const override; |
65 | 65 |
66 // Return the specific type of this control, which will be one of the | 66 // Return the specific type of this control, which will be one of the |
67 // string constants defined in extension_accessibility_api_constants.h. | 67 // string constants defined in extension_accessibility_api_constants.h. |
68 virtual const char* type() const = 0; | 68 virtual const char* type() const = 0; |
69 | 69 |
70 const std::string& name() const { return name_; } | 70 const std::string& name() const { return name_; } |
71 | 71 |
72 const std::string& context() const { return context_; } | 72 const std::string& context() const { return context_; } |
73 | 73 |
74 void set_bounds(const gfx::Rect& bounds) { bounds_ = bounds; } | 74 void set_bounds(const gfx::Rect& bounds) { bounds_ = bounds; } |
(...skipping 15 matching lines...) Expand all Loading... |
90 // The bounds of the control in global screen coordinates. | 90 // The bounds of the control in global screen coordinates. |
91 gfx::Rect bounds_; | 91 gfx::Rect bounds_; |
92 }; | 92 }; |
93 | 93 |
94 // Accessibility information about a window passed to onWindowOpened | 94 // Accessibility information about a window passed to onWindowOpened |
95 // and onWindowClosed event listeners. | 95 // and onWindowClosed event listeners. |
96 class AccessibilityWindowInfo : public AccessibilityControlInfo { | 96 class AccessibilityWindowInfo : public AccessibilityControlInfo { |
97 public: | 97 public: |
98 AccessibilityWindowInfo(Profile* profile, const std::string& window_name); | 98 AccessibilityWindowInfo(Profile* profile, const std::string& window_name); |
99 | 99 |
100 virtual const char* type() const OVERRIDE; | 100 virtual const char* type() const override; |
101 }; | 101 }; |
102 | 102 |
103 // Accessibility information about a push button passed to onControlFocused | 103 // Accessibility information about a push button passed to onControlFocused |
104 // and onControlAction event listeners. | 104 // and onControlAction event listeners. |
105 class AccessibilityButtonInfo : public AccessibilityControlInfo { | 105 class AccessibilityButtonInfo : public AccessibilityControlInfo { |
106 public: | 106 public: |
107 AccessibilityButtonInfo(Profile* profile, | 107 AccessibilityButtonInfo(Profile* profile, |
108 const std::string& button_name, | 108 const std::string& button_name, |
109 const std::string& context); | 109 const std::string& context); |
110 | 110 |
111 virtual const char* type() const OVERRIDE; | 111 virtual const char* type() const override; |
112 }; | 112 }; |
113 | 113 |
114 // Accessibility information about static text passed to onControlFocused | 114 // Accessibility information about static text passed to onControlFocused |
115 // and onControlAction event listeners. | 115 // and onControlAction event listeners. |
116 class AccessibilityStaticTextInfo : public AccessibilityControlInfo { | 116 class AccessibilityStaticTextInfo : public AccessibilityControlInfo { |
117 public: | 117 public: |
118 AccessibilityStaticTextInfo(Profile* profile, | 118 AccessibilityStaticTextInfo(Profile* profile, |
119 const std::string& text, | 119 const std::string& text, |
120 const std::string& context); | 120 const std::string& context); |
121 | 121 |
122 virtual const char* type() const OVERRIDE; | 122 virtual const char* type() const override; |
123 }; | 123 }; |
124 | 124 |
125 // Accessibility information about a hyperlink passed to onControlFocused | 125 // Accessibility information about a hyperlink passed to onControlFocused |
126 // and onControlAction event listeners. | 126 // and onControlAction event listeners. |
127 class AccessibilityLinkInfo : public AccessibilityControlInfo { | 127 class AccessibilityLinkInfo : public AccessibilityControlInfo { |
128 public: | 128 public: |
129 AccessibilityLinkInfo(Profile* profile, | 129 AccessibilityLinkInfo(Profile* profile, |
130 const std::string& link_name, | 130 const std::string& link_name, |
131 const std::string& context); | 131 const std::string& context); |
132 | 132 |
133 virtual const char* type() const OVERRIDE; | 133 virtual const char* type() const override; |
134 }; | 134 }; |
135 | 135 |
136 // Accessibility information about a radio button passed to onControlFocused | 136 // Accessibility information about a radio button passed to onControlFocused |
137 // and onControlAction event listeners. | 137 // and onControlAction event listeners. |
138 class AccessibilityRadioButtonInfo : public AccessibilityControlInfo { | 138 class AccessibilityRadioButtonInfo : public AccessibilityControlInfo { |
139 public: | 139 public: |
140 AccessibilityRadioButtonInfo(Profile* profile, | 140 AccessibilityRadioButtonInfo(Profile* profile, |
141 const std::string& name, | 141 const std::string& name, |
142 const std::string& context, | 142 const std::string& context, |
143 bool checked, | 143 bool checked, |
144 int item_index, | 144 int item_index, |
145 int item_count); | 145 int item_count); |
146 | 146 |
147 virtual const char* type() const OVERRIDE; | 147 virtual const char* type() const override; |
148 | 148 |
149 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; | 149 virtual void SerializeToDict(base::DictionaryValue* dict) const override; |
150 | 150 |
151 void SetChecked(bool checked) { checked_ = checked; } | 151 void SetChecked(bool checked) { checked_ = checked; } |
152 | 152 |
153 int item_index() const { return item_index_; } | 153 int item_index() const { return item_index_; } |
154 int item_count() const { return item_count_; } | 154 int item_count() const { return item_count_; } |
155 bool checked() const { return checked_; } | 155 bool checked() const { return checked_; } |
156 | 156 |
157 private: | 157 private: |
158 bool checked_; | 158 bool checked_; |
159 // The 0-based index of this radio button and number of buttons in the group. | 159 // The 0-based index of this radio button and number of buttons in the group. |
160 int item_index_; | 160 int item_index_; |
161 int item_count_; | 161 int item_count_; |
162 }; | 162 }; |
163 | 163 |
164 // Accessibility information about a checkbox passed to onControlFocused | 164 // Accessibility information about a checkbox passed to onControlFocused |
165 // and onControlAction event listeners. | 165 // and onControlAction event listeners. |
166 class AccessibilityCheckboxInfo : public AccessibilityControlInfo { | 166 class AccessibilityCheckboxInfo : public AccessibilityControlInfo { |
167 public: | 167 public: |
168 AccessibilityCheckboxInfo(Profile* profile, | 168 AccessibilityCheckboxInfo(Profile* profile, |
169 const std::string& name, | 169 const std::string& name, |
170 const std::string& context, | 170 const std::string& context, |
171 bool checked); | 171 bool checked); |
172 | 172 |
173 virtual const char* type() const OVERRIDE; | 173 virtual const char* type() const override; |
174 | 174 |
175 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; | 175 virtual void SerializeToDict(base::DictionaryValue* dict) const override; |
176 | 176 |
177 void SetChecked(bool checked) { checked_ = checked; } | 177 void SetChecked(bool checked) { checked_ = checked; } |
178 | 178 |
179 bool checked() const { return checked_; } | 179 bool checked() const { return checked_; } |
180 | 180 |
181 private: | 181 private: |
182 bool checked_; | 182 bool checked_; |
183 }; | 183 }; |
184 | 184 |
185 // Accessibility information about a tab passed to onControlFocused | 185 // Accessibility information about a tab passed to onControlFocused |
186 // and onControlAction event listeners. | 186 // and onControlAction event listeners. |
187 class AccessibilityTabInfo : public AccessibilityControlInfo { | 187 class AccessibilityTabInfo : public AccessibilityControlInfo { |
188 public: | 188 public: |
189 AccessibilityTabInfo(Profile* profile, | 189 AccessibilityTabInfo(Profile* profile, |
190 const std::string& tab_name, | 190 const std::string& tab_name, |
191 const std::string& context, | 191 const std::string& context, |
192 int tab_index, | 192 int tab_index, |
193 int tab_count); | 193 int tab_count); |
194 | 194 |
195 virtual const char* type() const OVERRIDE; | 195 virtual const char* type() const override; |
196 | 196 |
197 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; | 197 virtual void SerializeToDict(base::DictionaryValue* dict) const override; |
198 | 198 |
199 void SetTab(int tab_index, std::string tab_name) { | 199 void SetTab(int tab_index, std::string tab_name) { |
200 tab_index_ = tab_index; | 200 tab_index_ = tab_index; |
201 name_ = tab_name; | 201 name_ = tab_name; |
202 } | 202 } |
203 | 203 |
204 int tab_index() const { return tab_index_; } | 204 int tab_index() const { return tab_index_; } |
205 int tab_count() const { return tab_count_; } | 205 int tab_count() const { return tab_count_; } |
206 | 206 |
207 private: | 207 private: |
208 // The 0-based index of this tab and number of tabs in the group. | 208 // The 0-based index of this tab and number of tabs in the group. |
209 int tab_index_; | 209 int tab_index_; |
210 int tab_count_; | 210 int tab_count_; |
211 }; | 211 }; |
212 | 212 |
213 // Accessibility information about a combo box passed to onControlFocused | 213 // Accessibility information about a combo box passed to onControlFocused |
214 // and onControlAction event listeners. | 214 // and onControlAction event listeners. |
215 class AccessibilityComboBoxInfo : public AccessibilityControlInfo { | 215 class AccessibilityComboBoxInfo : public AccessibilityControlInfo { |
216 public: | 216 public: |
217 AccessibilityComboBoxInfo(Profile* profile, | 217 AccessibilityComboBoxInfo(Profile* profile, |
218 const std::string& name, | 218 const std::string& name, |
219 const std::string& context, | 219 const std::string& context, |
220 const std::string& value, | 220 const std::string& value, |
221 int item_index, | 221 int item_index, |
222 int item_count); | 222 int item_count); |
223 | 223 |
224 virtual const char* type() const OVERRIDE; | 224 virtual const char* type() const override; |
225 | 225 |
226 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; | 226 virtual void SerializeToDict(base::DictionaryValue* dict) const override; |
227 | 227 |
228 void SetValue(int item_index, const std::string& value) { | 228 void SetValue(int item_index, const std::string& value) { |
229 item_index_ = item_index; | 229 item_index_ = item_index; |
230 value_ = value; | 230 value_ = value; |
231 } | 231 } |
232 | 232 |
233 int item_index() const { return item_index_; } | 233 int item_index() const { return item_index_; } |
234 int item_count() const { return item_count_; } | 234 int item_count() const { return item_count_; } |
235 const std::string& value() const { return value_; } | 235 const std::string& value() const { return value_; } |
236 | 236 |
237 private: | 237 private: |
238 std::string value_; | 238 std::string value_; |
239 // The 0-based index of the current item and the number of total items. | 239 // The 0-based index of the current item and the number of total items. |
240 // If the value is not one of the drop-down options, |item_index_| should | 240 // If the value is not one of the drop-down options, |item_index_| should |
241 // be -1. | 241 // be -1. |
242 int item_index_; | 242 int item_index_; |
243 int item_count_; | 243 int item_count_; |
244 }; | 244 }; |
245 | 245 |
246 | 246 |
247 // Accessibility information about a text box, passed to onControlFocused, | 247 // Accessibility information about a text box, passed to onControlFocused, |
248 // onControlAction, and onTextChanged event listeners. | 248 // onControlAction, and onTextChanged event listeners. |
249 class AccessibilityTextBoxInfo : public AccessibilityControlInfo { | 249 class AccessibilityTextBoxInfo : public AccessibilityControlInfo { |
250 public: | 250 public: |
251 AccessibilityTextBoxInfo(Profile* profile, | 251 AccessibilityTextBoxInfo(Profile* profile, |
252 const std::string& name, | 252 const std::string& name, |
253 const std::string& context, | 253 const std::string& context, |
254 bool password); | 254 bool password); |
255 | 255 |
256 virtual const char* type() const OVERRIDE; | 256 virtual const char* type() const override; |
257 | 257 |
258 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; | 258 virtual void SerializeToDict(base::DictionaryValue* dict) const override; |
259 | 259 |
260 void SetValue( | 260 void SetValue( |
261 const std::string& value, int selection_start, int selection_end) { | 261 const std::string& value, int selection_start, int selection_end) { |
262 value_ = value; | 262 value_ = value; |
263 selection_start_ = selection_start; | 263 selection_start_ = selection_start; |
264 selection_end_ = selection_end; | 264 selection_end_ = selection_end; |
265 } | 265 } |
266 | 266 |
267 const std::string& value() const { return value_; } | 267 const std::string& value() const { return value_; } |
268 bool password() const { return password_; } | 268 bool password() const { return password_; } |
(...skipping 11 matching lines...) Expand all Loading... |
280 // and onControlAction event listeners. | 280 // and onControlAction event listeners. |
281 class AccessibilityListBoxInfo : public AccessibilityControlInfo { | 281 class AccessibilityListBoxInfo : public AccessibilityControlInfo { |
282 public: | 282 public: |
283 AccessibilityListBoxInfo(Profile* profile, | 283 AccessibilityListBoxInfo(Profile* profile, |
284 const std::string& name, | 284 const std::string& name, |
285 const std::string& context, | 285 const std::string& context, |
286 const std::string& value, | 286 const std::string& value, |
287 int item_index, | 287 int item_index, |
288 int item_count); | 288 int item_count); |
289 | 289 |
290 virtual const char* type() const OVERRIDE; | 290 virtual const char* type() const override; |
291 | 291 |
292 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; | 292 virtual void SerializeToDict(base::DictionaryValue* dict) const override; |
293 | 293 |
294 void SetValue(int item_index, std::string value) { | 294 void SetValue(int item_index, std::string value) { |
295 item_index_ = item_index; | 295 item_index_ = item_index; |
296 value_ = value; | 296 value_ = value; |
297 } | 297 } |
298 | 298 |
299 int item_index() const { return item_index_; } | 299 int item_index() const { return item_index_; } |
300 int item_count() const { return item_count_; } | 300 int item_count() const { return item_count_; } |
301 const std::string& value() const { return value_; } | 301 const std::string& value() const { return value_; } |
302 | 302 |
303 private: | 303 private: |
304 std::string value_; | 304 std::string value_; |
305 // The 0-based index of the current item and the number of total items. | 305 // The 0-based index of the current item and the number of total items. |
306 // If the value is not one of the drop-down options, |item_index_| should | 306 // If the value is not one of the drop-down options, |item_index_| should |
307 // be -1. | 307 // be -1. |
308 int item_index_; | 308 int item_index_; |
309 int item_count_; | 309 int item_count_; |
310 }; | 310 }; |
311 | 311 |
312 // Accessibility information about a menu; this class is used by | 312 // Accessibility information about a menu; this class is used by |
313 // onMenuOpened, onMenuClosed, and onControlFocused event listeners. | 313 // onMenuOpened, onMenuClosed, and onControlFocused event listeners. |
314 class AccessibilityMenuInfo : public AccessibilityControlInfo { | 314 class AccessibilityMenuInfo : public AccessibilityControlInfo { |
315 public: | 315 public: |
316 AccessibilityMenuInfo(Profile* profile, const std::string& menu_name); | 316 AccessibilityMenuInfo(Profile* profile, const std::string& menu_name); |
317 | 317 |
318 virtual const char* type() const OVERRIDE; | 318 virtual const char* type() const override; |
319 }; | 319 }; |
320 | 320 |
321 // Accessibility information about a menu item; this class is used by | 321 // Accessibility information about a menu item; this class is used by |
322 // onControlFocused event listeners. | 322 // onControlFocused event listeners. |
323 class AccessibilityMenuItemInfo : public AccessibilityControlInfo { | 323 class AccessibilityMenuItemInfo : public AccessibilityControlInfo { |
324 public: | 324 public: |
325 AccessibilityMenuItemInfo(Profile* profile, | 325 AccessibilityMenuItemInfo(Profile* profile, |
326 const std::string& name, | 326 const std::string& name, |
327 const std::string& context, | 327 const std::string& context, |
328 bool has_submenu, | 328 bool has_submenu, |
329 int item_index, | 329 int item_index, |
330 int item_count); | 330 int item_count); |
331 | 331 |
332 virtual const char* type() const OVERRIDE; | 332 virtual const char* type() const override; |
333 | 333 |
334 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; | 334 virtual void SerializeToDict(base::DictionaryValue* dict) const override; |
335 | 335 |
336 int item_index() const { return item_index_; } | 336 int item_index() const { return item_index_; } |
337 int item_count() const { return item_count_; } | 337 int item_count() const { return item_count_; } |
338 bool has_submenu() const { return has_submenu_; } | 338 bool has_submenu() const { return has_submenu_; } |
339 | 339 |
340 private: | 340 private: |
341 bool has_submenu_; | 341 bool has_submenu_; |
342 // The 0-based index of the current item and the number of total items. | 342 // The 0-based index of the current item and the number of total items. |
343 int item_index_; | 343 int item_index_; |
344 int item_count_; | 344 int item_count_; |
345 }; | 345 }; |
346 | 346 |
347 // Accessibility information about a tree; this class is used by | 347 // Accessibility information about a tree; this class is used by |
348 // onControlFocused event listeners. | 348 // onControlFocused event listeners. |
349 class AccessibilityTreeInfo : public AccessibilityControlInfo { | 349 class AccessibilityTreeInfo : public AccessibilityControlInfo { |
350 public: | 350 public: |
351 AccessibilityTreeInfo(Profile* profile, const std::string& menu_name); | 351 AccessibilityTreeInfo(Profile* profile, const std::string& menu_name); |
352 | 352 |
353 virtual const char* type() const OVERRIDE; | 353 virtual const char* type() const override; |
354 }; | 354 }; |
355 | 355 |
356 // Accessibility information about a tree item; this class is used by | 356 // Accessibility information about a tree item; this class is used by |
357 // onControlFocused event listeners. | 357 // onControlFocused event listeners. |
358 class AccessibilityTreeItemInfo : public AccessibilityControlInfo { | 358 class AccessibilityTreeItemInfo : public AccessibilityControlInfo { |
359 public: | 359 public: |
360 AccessibilityTreeItemInfo(Profile* profile, | 360 AccessibilityTreeItemInfo(Profile* profile, |
361 const std::string& name, | 361 const std::string& name, |
362 const std::string& context, | 362 const std::string& context, |
363 int item_depth, | 363 int item_depth, |
364 int item_index, | 364 int item_index, |
365 int item_count, | 365 int item_count, |
366 int children_count, | 366 int children_count, |
367 bool is_expanded); | 367 bool is_expanded); |
368 | 368 |
369 virtual const char* type() const OVERRIDE; | 369 virtual const char* type() const override; |
370 | 370 |
371 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; | 371 virtual void SerializeToDict(base::DictionaryValue* dict) const override; |
372 | 372 |
373 int item_depth() const { return item_depth_; } | 373 int item_depth() const { return item_depth_; } |
374 int item_index() const { return item_index_; } | 374 int item_index() const { return item_index_; } |
375 int item_count() const { return item_count_; } | 375 int item_count() const { return item_count_; } |
376 int children_count() const { return children_count_; } | 376 int children_count() const { return children_count_; } |
377 bool is_expanded() const { return is_expanded_; } | 377 bool is_expanded() const { return is_expanded_; } |
378 | 378 |
379 private: | 379 private: |
380 // 0-based item depth. | 380 // 0-based item depth. |
381 int item_depth_; | 381 int item_depth_; |
(...skipping 10 matching lines...) Expand all Loading... |
392 | 392 |
393 // Accessibility information about a slider passed to onControlFocused | 393 // Accessibility information about a slider passed to onControlFocused |
394 // and onControlAction event listeners. | 394 // and onControlAction event listeners. |
395 class AccessibilitySliderInfo : public AccessibilityControlInfo { | 395 class AccessibilitySliderInfo : public AccessibilityControlInfo { |
396 public: | 396 public: |
397 AccessibilitySliderInfo(Profile* profile, | 397 AccessibilitySliderInfo(Profile* profile, |
398 const std::string& name, | 398 const std::string& name, |
399 const std::string& context, | 399 const std::string& context, |
400 const std::string& value); | 400 const std::string& value); |
401 | 401 |
402 virtual const char* type() const OVERRIDE; | 402 virtual const char* type() const override; |
403 | 403 |
404 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE; | 404 virtual void SerializeToDict(base::DictionaryValue* dict) const override; |
405 | 405 |
406 const std::string& value() const { return value_; } | 406 const std::string& value() const { return value_; } |
407 | 407 |
408 private: | 408 private: |
409 std::string value_; | 409 std::string value_; |
410 }; | 410 }; |
411 | 411 |
412 // Accessibility information about an alert passed to onControlAction event. | 412 // Accessibility information about an alert passed to onControlAction event. |
413 class AccessibilityAlertInfo : public AccessibilityControlInfo { | 413 class AccessibilityAlertInfo : public AccessibilityControlInfo { |
414 public: | 414 public: |
415 AccessibilityAlertInfo(Profile* profile, const std::string& name); | 415 AccessibilityAlertInfo(Profile* profile, const std::string& name); |
416 | 416 |
417 virtual const char* type() const OVERRIDE; | 417 virtual const char* type() const override; |
418 }; | 418 }; |
419 | 419 |
420 #endif // CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENTS_H_ | 420 #endif // CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EVENTS_H_ |
OLD | NEW |