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

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

Issue 8558014: Add experimental extension APIs to notify about wakeup and screen unlock (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Codereview Created 9 years, 1 month 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_events.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_EVENTS_H_ 5 #ifndef CHROME_BROWSER_ACCESSIBILITY_EVENTS_H_
6 #define CHROME_BROWSER_ACCESSIBILITY_EVENTS_H_ 6 #define CHROME_BROWSER_ACCESSIBILITY_EVENTS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // The name of the control, like "OK" or "Password". 65 // The name of the control, like "OK" or "Password".
66 std::string name_; 66 std::string name_;
67 }; 67 };
68 68
69 // Accessibility information about a window passed to onWindowOpened 69 // Accessibility information about a window passed to onWindowOpened
70 // and onWindowClosed event listeners. 70 // and onWindowClosed event listeners.
71 class AccessibilityWindowInfo : public AccessibilityControlInfo { 71 class AccessibilityWindowInfo : public AccessibilityControlInfo {
72 public: 72 public:
73 AccessibilityWindowInfo(Profile* profile, const std::string& window_name); 73 AccessibilityWindowInfo(Profile* profile, const std::string& window_name);
74 74
75 virtual const char* type() const; 75 virtual const char* type() const OVERRIDE;
hashimoto 2011/11/18 12:18:08 It looks like a good chance to add OVERRIDE
76 }; 76 };
77 77
78 // Accessibility information about a push button passed to onControlFocused 78 // Accessibility information about a push button passed to onControlFocused
79 // and onControlAction event listeners. 79 // and onControlAction event listeners.
80 class AccessibilityButtonInfo : public AccessibilityControlInfo { 80 class AccessibilityButtonInfo : public AccessibilityControlInfo {
81 public: 81 public:
82 AccessibilityButtonInfo(Profile* profile, const std::string& button_name); 82 AccessibilityButtonInfo(Profile* profile, const std::string& button_name);
83 83
84 virtual const char* type() const; 84 virtual const char* type() const OVERRIDE;
85 }; 85 };
86 86
87 // Accessibility information about a hyperlink passed to onControlFocused 87 // Accessibility information about a hyperlink passed to onControlFocused
88 // and onControlAction event listeners. 88 // and onControlAction event listeners.
89 class AccessibilityLinkInfo : public AccessibilityControlInfo { 89 class AccessibilityLinkInfo : public AccessibilityControlInfo {
90 public: 90 public:
91 AccessibilityLinkInfo(Profile* profile, const std::string& link_name); 91 AccessibilityLinkInfo(Profile* profile, const std::string& link_name);
92 92
93 virtual const char* type() const; 93 virtual const char* type() const OVERRIDE;
94 }; 94 };
95 95
96 // Accessibility information about a radio button passed to onControlFocused 96 // Accessibility information about a radio button passed to onControlFocused
97 // and onControlAction event listeners. 97 // and onControlAction event listeners.
98 class AccessibilityRadioButtonInfo : public AccessibilityControlInfo { 98 class AccessibilityRadioButtonInfo : public AccessibilityControlInfo {
99 public: 99 public:
100 AccessibilityRadioButtonInfo(Profile* profile, 100 AccessibilityRadioButtonInfo(Profile* profile,
101 const std::string& name, 101 const std::string& name,
102 bool checked, 102 bool checked,
103 int item_index, 103 int item_index,
104 int item_count); 104 int item_count);
105 105
106 virtual const char* type() const; 106 virtual const char* type() const OVERRIDE;
107 107
108 virtual void SerializeToDict(base::DictionaryValue* dict) const; 108 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE;
109 109
110 void SetChecked(bool checked) { checked_ = checked; } 110 void SetChecked(bool checked) { checked_ = checked; }
111 111
112 int item_index() const { return item_index_; } 112 int item_index() const { return item_index_; }
113 int item_count() const { return item_count_; } 113 int item_count() const { return item_count_; }
114 bool checked() const { return checked_; } 114 bool checked() const { return checked_; }
115 115
116 private: 116 private:
117 bool checked_; 117 bool checked_;
118 // The 0-based index of this radio button and number of buttons in the group. 118 // The 0-based index of this radio button and number of buttons in the group.
119 int item_index_; 119 int item_index_;
120 int item_count_; 120 int item_count_;
121 }; 121 };
122 122
123 // Accessibility information about a checkbox passed to onControlFocused 123 // Accessibility information about a checkbox passed to onControlFocused
124 // and onControlAction event listeners. 124 // and onControlAction event listeners.
125 class AccessibilityCheckboxInfo : public AccessibilityControlInfo { 125 class AccessibilityCheckboxInfo : public AccessibilityControlInfo {
126 public: 126 public:
127 AccessibilityCheckboxInfo(Profile* profile, 127 AccessibilityCheckboxInfo(Profile* profile,
128 const std::string& name, 128 const std::string& name,
129 bool checked); 129 bool checked);
130 130
131 virtual const char* type() const; 131 virtual const char* type() const OVERRIDE;
132 132
133 virtual void SerializeToDict(base::DictionaryValue* dict) const; 133 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE;
134 134
135 void SetChecked(bool checked) { checked_ = checked; } 135 void SetChecked(bool checked) { checked_ = checked; }
136 136
137 bool checked() const { return checked_; } 137 bool checked() const { return checked_; }
138 138
139 private: 139 private:
140 bool checked_; 140 bool checked_;
141 }; 141 };
142 142
143 // Accessibility information about a tab passed to onControlFocused 143 // Accessibility information about a tab passed to onControlFocused
144 // and onControlAction event listeners. 144 // and onControlAction event listeners.
145 class AccessibilityTabInfo : public AccessibilityControlInfo { 145 class AccessibilityTabInfo : public AccessibilityControlInfo {
146 public: 146 public:
147 AccessibilityTabInfo(Profile* profile, 147 AccessibilityTabInfo(Profile* profile,
148 const std::string& tab_name, 148 const std::string& tab_name,
149 int tab_index, 149 int tab_index,
150 int tab_count); 150 int tab_count);
151 151
152 virtual const char* type() const; 152 virtual const char* type() const OVERRIDE;
153 153
154 virtual void SerializeToDict(base::DictionaryValue* dict) const; 154 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE;
155 155
156 void SetTab(int tab_index, std::string tab_name) { 156 void SetTab(int tab_index, std::string tab_name) {
157 tab_index_ = tab_index; 157 tab_index_ = tab_index;
158 name_ = tab_name; 158 name_ = tab_name;
159 } 159 }
160 160
161 int tab_index() const { return tab_index_; } 161 int tab_index() const { return tab_index_; }
162 int tab_count() const { return tab_count_; } 162 int tab_count() const { return tab_count_; }
163 163
164 private: 164 private:
165 // The 0-based index of this tab and number of tabs in the group. 165 // The 0-based index of this tab and number of tabs in the group.
166 int tab_index_; 166 int tab_index_;
167 int tab_count_; 167 int tab_count_;
168 }; 168 };
169 169
170 // Accessibility information about a combo box passed to onControlFocused 170 // Accessibility information about a combo box passed to onControlFocused
171 // and onControlAction event listeners. 171 // and onControlAction event listeners.
172 class AccessibilityComboBoxInfo : public AccessibilityControlInfo { 172 class AccessibilityComboBoxInfo : public AccessibilityControlInfo {
173 public: 173 public:
174 AccessibilityComboBoxInfo(Profile* profile, 174 AccessibilityComboBoxInfo(Profile* profile,
175 const std::string& name, 175 const std::string& name,
176 const std::string& value, 176 const std::string& value,
177 int item_index, 177 int item_index,
178 int item_count); 178 int item_count);
179 179
180 virtual const char* type() const; 180 virtual const char* type() const OVERRIDE;
181 181
182 virtual void SerializeToDict(base::DictionaryValue* dict) const; 182 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE;
183 183
184 void SetValue(int item_index, const std::string& value) { 184 void SetValue(int item_index, const std::string& value) {
185 item_index_ = item_index; 185 item_index_ = item_index;
186 value_ = value; 186 value_ = value;
187 } 187 }
188 188
189 int item_index() const { return item_index_; } 189 int item_index() const { return item_index_; }
190 int item_count() const { return item_count_; } 190 int item_count() const { return item_count_; }
191 const std::string& value() const { return value_; } 191 const std::string& value() const { return value_; }
192 192
193 private: 193 private:
194 std::string value_; 194 std::string value_;
195 // The 0-based index of the current item and the number of total items. 195 // The 0-based index of the current item and the number of total items.
196 // If the value is not one of the drop-down options, |item_index_| should 196 // If the value is not one of the drop-down options, |item_index_| should
197 // be -1. 197 // be -1.
198 int item_index_; 198 int item_index_;
199 int item_count_; 199 int item_count_;
200 }; 200 };
201 201
202 // Accessibility information about a text box, passed to onControlFocused, 202 // Accessibility information about a text box, passed to onControlFocused,
203 // onControlAction, and onTextChanged event listeners. 203 // onControlAction, and onTextChanged event listeners.
204 class AccessibilityTextBoxInfo : public AccessibilityControlInfo { 204 class AccessibilityTextBoxInfo : public AccessibilityControlInfo {
205 public: 205 public:
206 AccessibilityTextBoxInfo(Profile* profile, 206 AccessibilityTextBoxInfo(Profile* profile,
207 const std::string& name, 207 const std::string& name,
208 bool password); 208 bool password);
209 209
210 virtual const char* type() const; 210 virtual const char* type() const OVERRIDE;
211 211
212 virtual void SerializeToDict(base::DictionaryValue* dict) const; 212 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE;
213 213
214 void SetValue( 214 void SetValue(
215 const std::string& value, int selection_start, int selection_end) { 215 const std::string& value, int selection_start, int selection_end) {
216 value_ = value; 216 value_ = value;
217 selection_start_ = selection_start; 217 selection_start_ = selection_start;
218 selection_end_ = selection_end; 218 selection_end_ = selection_end;
219 } 219 }
220 220
221 const std::string& value() const { return value_; } 221 const std::string& value() const { return value_; }
222 bool password() const { return password_; } 222 bool password() const { return password_; }
(...skipping 10 matching lines...) Expand all
233 // Accessibility information about a combo box passed to onControlFocused 233 // Accessibility information about a combo box passed to onControlFocused
234 // and onControlAction event listeners. 234 // and onControlAction event listeners.
235 class AccessibilityListBoxInfo : public AccessibilityControlInfo { 235 class AccessibilityListBoxInfo : public AccessibilityControlInfo {
236 public: 236 public:
237 AccessibilityListBoxInfo(Profile* profile, 237 AccessibilityListBoxInfo(Profile* profile,
238 const std::string& name, 238 const std::string& name,
239 const std::string& value, 239 const std::string& value,
240 int item_index, 240 int item_index,
241 int item_count); 241 int item_count);
242 242
243 virtual const char* type() const; 243 virtual const char* type() const OVERRIDE;
244 244
245 virtual void SerializeToDict(base::DictionaryValue* dict) const; 245 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE;
246 246
247 void SetValue(int item_index, std::string value) { 247 void SetValue(int item_index, std::string value) {
248 item_index_ = item_index; 248 item_index_ = item_index;
249 value_ = value; 249 value_ = value;
250 } 250 }
251 251
252 int item_index() const { return item_index_; } 252 int item_index() const { return item_index_; }
253 int item_count() const { return item_count_; } 253 int item_count() const { return item_count_; }
254 const std::string& value() const { return value_; } 254 const std::string& value() const { return value_; }
255 255
256 private: 256 private:
257 std::string value_; 257 std::string value_;
258 // The 0-based index of the current item and the number of total items. 258 // The 0-based index of the current item and the number of total items.
259 // If the value is not one of the drop-down options, |item_index_| should 259 // If the value is not one of the drop-down options, |item_index_| should
260 // be -1. 260 // be -1.
261 int item_index_; 261 int item_index_;
262 int item_count_; 262 int item_count_;
263 }; 263 };
264 264
265 // Accessibility information about a menu; this class is used by 265 // Accessibility information about a menu; this class is used by
266 // onMenuOpened, onMenuClosed, and onControlFocused event listeners. 266 // onMenuOpened, onMenuClosed, and onControlFocused event listeners.
267 class AccessibilityMenuInfo : public AccessibilityControlInfo { 267 class AccessibilityMenuInfo : public AccessibilityControlInfo {
268 public: 268 public:
269 AccessibilityMenuInfo(Profile* profile, const std::string& menu_name); 269 AccessibilityMenuInfo(Profile* profile, const std::string& menu_name);
270 270
271 virtual const char* type() const; 271 virtual const char* type() const OVERRIDE;
272 }; 272 };
273 273
274 // Accessibility information about a volume; this class is used by 274 // Accessibility information about a volume; this class is used by
275 // onVolumeUp, onVolumeDown, and onVolumeMute event listeners. 275 // onVolumeUp, onVolumeDown, and onVolumeMute event listeners.
276 class AccessibilityVolumeInfo : public AccessibilityEventInfo { 276 class AccessibilityVolumeInfo : public AccessibilityEventInfo {
277 public: 277 public:
278 // |volume| must range between 0 to 100. 278 // |volume| must range between 0 to 100.
279 AccessibilityVolumeInfo(Profile* profile, double volume, bool is_muted); 279 AccessibilityVolumeInfo(Profile* profile, double volume, bool is_muted);
280 280
281 virtual void SerializeToDict(base::DictionaryValue* dict) const; 281 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE;
282 282
283 private: 283 private:
284 double volume_; 284 double volume_;
285 bool is_muted_; 285 bool is_muted_;
286 }; 286 };
287 287
288 // Empty accessibility event information; this class is used by
289 // onScreenUnlocked and onWokeUp.
290 class AccessibilityEmptyEventInfo : public AccessibilityEventInfo {
dmazzoni 2011/11/21 06:49:57 Hmmm, I'm not sure I like having an "empty" subcla
hashimoto 2011/11/21 12:36:27 Created ScreenUnlockedEventInfo and WokeUpEventInf
291 public:
292 AccessibilityEmptyEventInfo(Profile* profile);
293 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE;
294 };
295
288 // Accessibility information about a menu item; this class is used by 296 // Accessibility information about a menu item; this class is used by
289 // onControlFocused event listeners. 297 // onControlFocused event listeners.
290 class AccessibilityMenuItemInfo : public AccessibilityControlInfo { 298 class AccessibilityMenuItemInfo : public AccessibilityControlInfo {
291 public: 299 public:
292 AccessibilityMenuItemInfo(Profile* profile, 300 AccessibilityMenuItemInfo(Profile* profile,
293 const std::string& name, 301 const std::string& name,
294 bool has_submenu, 302 bool has_submenu,
295 int item_index, 303 int item_index,
296 int item_count); 304 int item_count);
297 305
298 virtual const char* type() const; 306 virtual const char* type() const OVERRIDE;
299 307
300 virtual void SerializeToDict(base::DictionaryValue* dict) const; 308 virtual void SerializeToDict(base::DictionaryValue* dict) const OVERRIDE;
301 309
302 int item_index() const { return item_index_; } 310 int item_index() const { return item_index_; }
303 int item_count() const { return item_count_; } 311 int item_count() const { return item_count_; }
304 bool has_submenu() const { return has_submenu_; } 312 bool has_submenu() const { return has_submenu_; }
305 313
306 private: 314 private:
307 bool has_submenu_; 315 bool has_submenu_;
308 // The 0-based index of the current item and the number of total items. 316 // The 0-based index of the current item and the number of total items.
309 int item_index_; 317 int item_index_;
310 int item_count_; 318 int item_count_;
311 }; 319 };
312 320
313 #endif // CHROME_BROWSER_ACCESSIBILITY_EVENTS_H_ 321 #endif // CHROME_BROWSER_ACCESSIBILITY_EVENTS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/accessibility_events.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698