| 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 #include "chrome/browser/accessibility/accessibility_events.h" | 5 #include "chrome/browser/accessibility/accessibility_events.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/accessibility/accessibility_extension_api.h" | 8 #include "chrome/browser/accessibility/accessibility_extension_api.h" |
| 9 #include "chrome/browser/accessibility/accessibility_extension_api_constants.h" | 9 #include "chrome/browser/accessibility/accessibility_extension_api_constants.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 AccessibilityControlInfo::AccessibilityControlInfo( | 52 AccessibilityControlInfo::AccessibilityControlInfo( |
| 53 Profile* profile, const std::string& name) | 53 Profile* profile, const std::string& name) |
| 54 : AccessibilityEventInfo(profile), | 54 : AccessibilityEventInfo(profile), |
| 55 name_(name) { | 55 name_(name) { |
| 56 } | 56 } |
| 57 | 57 |
| 58 AccessibilityControlInfo::~AccessibilityControlInfo() { | 58 AccessibilityControlInfo::~AccessibilityControlInfo() { |
| 59 } | 59 } |
| 60 | 60 |
| 61 void AccessibilityControlInfo::SerializeToDict(DictionaryValue *dict) const { | 61 void AccessibilityControlInfo::SerializeToDict( |
| 62 base::DictionaryValue *dict) const { |
| 62 dict->SetString(keys::kNameKey, name_); | 63 dict->SetString(keys::kNameKey, name_); |
| 63 dict->SetString(keys::kTypeKey, type()); | 64 dict->SetString(keys::kTypeKey, type()); |
| 64 if (!context_.empty()) | 65 if (!context_.empty()) |
| 65 dict->SetString(keys::kContextKey, context_); | 66 dict->SetString(keys::kContextKey, context_); |
| 66 } | 67 } |
| 67 | 68 |
| 68 AccessibilityWindowInfo::AccessibilityWindowInfo(Profile* profile, | 69 AccessibilityWindowInfo::AccessibilityWindowInfo(Profile* profile, |
| 69 const std::string& window_name) | 70 const std::string& window_name) |
| 70 : AccessibilityControlInfo(profile, window_name) { | 71 : AccessibilityControlInfo(profile, window_name) { |
| 71 } | 72 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 item_index_(item_index), | 109 item_index_(item_index), |
| 109 item_count_(item_count) { | 110 item_count_(item_count) { |
| 110 set_context(context); | 111 set_context(context); |
| 111 } | 112 } |
| 112 | 113 |
| 113 const char* AccessibilityRadioButtonInfo::type() const { | 114 const char* AccessibilityRadioButtonInfo::type() const { |
| 114 return keys::kTypeRadioButton; | 115 return keys::kTypeRadioButton; |
| 115 } | 116 } |
| 116 | 117 |
| 117 void AccessibilityRadioButtonInfo::SerializeToDict( | 118 void AccessibilityRadioButtonInfo::SerializeToDict( |
| 118 DictionaryValue *dict) const { | 119 base::DictionaryValue *dict) const { |
| 119 AccessibilityControlInfo::SerializeToDict(dict); | 120 AccessibilityControlInfo::SerializeToDict(dict); |
| 120 dict->SetBoolean(keys::kCheckedKey, checked_); | 121 dict->SetBoolean(keys::kCheckedKey, checked_); |
| 121 dict->SetInteger(keys::kItemIndexKey, item_index_); | 122 dict->SetInteger(keys::kItemIndexKey, item_index_); |
| 122 dict->SetInteger(keys::kItemCountKey, item_count_); | 123 dict->SetInteger(keys::kItemCountKey, item_count_); |
| 123 } | 124 } |
| 124 | 125 |
| 125 AccessibilityCheckboxInfo::AccessibilityCheckboxInfo(Profile* profile, | 126 AccessibilityCheckboxInfo::AccessibilityCheckboxInfo(Profile* profile, |
| 126 const std::string& name, | 127 const std::string& name, |
| 127 const std::string& context, | 128 const std::string& context, |
| 128 bool checked) | 129 bool checked) |
| 129 : AccessibilityControlInfo(profile, name), | 130 : AccessibilityControlInfo(profile, name), |
| 130 checked_(checked) { | 131 checked_(checked) { |
| 131 set_context(context); | 132 set_context(context); |
| 132 } | 133 } |
| 133 | 134 |
| 134 const char* AccessibilityCheckboxInfo::type() const { | 135 const char* AccessibilityCheckboxInfo::type() const { |
| 135 return keys::kTypeCheckbox; | 136 return keys::kTypeCheckbox; |
| 136 } | 137 } |
| 137 | 138 |
| 138 void AccessibilityCheckboxInfo::SerializeToDict(DictionaryValue *dict) const { | 139 void AccessibilityCheckboxInfo::SerializeToDict( |
| 140 base::DictionaryValue *dict) const { |
| 139 AccessibilityControlInfo::SerializeToDict(dict); | 141 AccessibilityControlInfo::SerializeToDict(dict); |
| 140 dict->SetBoolean(keys::kCheckedKey, checked_); | 142 dict->SetBoolean(keys::kCheckedKey, checked_); |
| 141 } | 143 } |
| 142 | 144 |
| 143 AccessibilityTabInfo::AccessibilityTabInfo(Profile* profile, | 145 AccessibilityTabInfo::AccessibilityTabInfo(Profile* profile, |
| 144 const std::string& tab_name, | 146 const std::string& tab_name, |
| 145 const std::string& context, | 147 const std::string& context, |
| 146 int tab_index, | 148 int tab_index, |
| 147 int tab_count) | 149 int tab_count) |
| 148 : AccessibilityControlInfo(profile, tab_name), | 150 : AccessibilityControlInfo(profile, tab_name), |
| 149 tab_index_(tab_index), | 151 tab_index_(tab_index), |
| 150 tab_count_(tab_count) { | 152 tab_count_(tab_count) { |
| 151 set_context(context); | 153 set_context(context); |
| 152 } | 154 } |
| 153 | 155 |
| 154 const char* AccessibilityTabInfo::type() const { | 156 const char* AccessibilityTabInfo::type() const { |
| 155 return keys::kTypeTab; | 157 return keys::kTypeTab; |
| 156 } | 158 } |
| 157 | 159 |
| 158 void AccessibilityTabInfo::SerializeToDict(DictionaryValue *dict) const { | 160 void AccessibilityTabInfo::SerializeToDict(base::DictionaryValue *dict) const { |
| 159 AccessibilityControlInfo::SerializeToDict(dict); | 161 AccessibilityControlInfo::SerializeToDict(dict); |
| 160 dict->SetInteger(keys::kItemIndexKey, tab_index_); | 162 dict->SetInteger(keys::kItemIndexKey, tab_index_); |
| 161 dict->SetInteger(keys::kItemCountKey, tab_count_); | 163 dict->SetInteger(keys::kItemCountKey, tab_count_); |
| 162 } | 164 } |
| 163 | 165 |
| 164 AccessibilityComboBoxInfo::AccessibilityComboBoxInfo(Profile* profile, | 166 AccessibilityComboBoxInfo::AccessibilityComboBoxInfo(Profile* profile, |
| 165 const std::string& name, | 167 const std::string& name, |
| 166 const std::string& context, | 168 const std::string& context, |
| 167 const std::string& value, | 169 const std::string& value, |
| 168 int item_index, | 170 int item_index, |
| 169 int item_count) | 171 int item_count) |
| 170 : AccessibilityControlInfo(profile, name), | 172 : AccessibilityControlInfo(profile, name), |
| 171 value_(value), | 173 value_(value), |
| 172 item_index_(item_index), | 174 item_index_(item_index), |
| 173 item_count_(item_count) { | 175 item_count_(item_count) { |
| 174 set_context(context); | 176 set_context(context); |
| 175 } | 177 } |
| 176 | 178 |
| 177 const char* AccessibilityComboBoxInfo::type() const { | 179 const char* AccessibilityComboBoxInfo::type() const { |
| 178 return keys::kTypeComboBox; | 180 return keys::kTypeComboBox; |
| 179 } | 181 } |
| 180 | 182 |
| 181 void AccessibilityComboBoxInfo::SerializeToDict(DictionaryValue *dict) const { | 183 void AccessibilityComboBoxInfo::SerializeToDict( |
| 184 base::DictionaryValue *dict) const { |
| 182 AccessibilityControlInfo::SerializeToDict(dict); | 185 AccessibilityControlInfo::SerializeToDict(dict); |
| 183 dict->SetString(keys::kValueKey, value_); | 186 dict->SetString(keys::kValueKey, value_); |
| 184 dict->SetInteger(keys::kItemIndexKey, item_index_); | 187 dict->SetInteger(keys::kItemIndexKey, item_index_); |
| 185 dict->SetInteger(keys::kItemCountKey, item_count_); | 188 dict->SetInteger(keys::kItemCountKey, item_count_); |
| 186 } | 189 } |
| 187 | 190 |
| 188 AccessibilityTextBoxInfo::AccessibilityTextBoxInfo(Profile* profile, | 191 AccessibilityTextBoxInfo::AccessibilityTextBoxInfo(Profile* profile, |
| 189 const std::string& name, | 192 const std::string& name, |
| 190 const std::string& context, | 193 const std::string& context, |
| 191 bool password) | 194 bool password) |
| 192 : AccessibilityControlInfo(profile, name), | 195 : AccessibilityControlInfo(profile, name), |
| 193 password_(password), | 196 password_(password), |
| 194 selection_start_(0), | 197 selection_start_(0), |
| 195 selection_end_(0) { | 198 selection_end_(0) { |
| 196 set_context(context); | 199 set_context(context); |
| 197 } | 200 } |
| 198 | 201 |
| 199 const char* AccessibilityTextBoxInfo::type() const { | 202 const char* AccessibilityTextBoxInfo::type() const { |
| 200 return keys::kTypeTextBox; | 203 return keys::kTypeTextBox; |
| 201 } | 204 } |
| 202 | 205 |
| 203 void AccessibilityTextBoxInfo::SerializeToDict(DictionaryValue *dict) const { | 206 void AccessibilityTextBoxInfo::SerializeToDict( |
| 207 base::DictionaryValue *dict) const { |
| 204 AccessibilityControlInfo::SerializeToDict(dict); | 208 AccessibilityControlInfo::SerializeToDict(dict); |
| 205 dict->SetString(keys::kValueKey, value_); | 209 dict->SetString(keys::kValueKey, value_); |
| 206 dict->SetBoolean(keys::kPasswordKey, password_); | 210 dict->SetBoolean(keys::kPasswordKey, password_); |
| 207 dict->SetInteger(keys::kSelectionStartKey, selection_start_); | 211 dict->SetInteger(keys::kSelectionStartKey, selection_start_); |
| 208 dict->SetInteger(keys::kSelectionEndKey, selection_end_); | 212 dict->SetInteger(keys::kSelectionEndKey, selection_end_); |
| 209 } | 213 } |
| 210 | 214 |
| 211 AccessibilityListBoxInfo::AccessibilityListBoxInfo(Profile* profile, | 215 AccessibilityListBoxInfo::AccessibilityListBoxInfo(Profile* profile, |
| 212 const std::string& name, | 216 const std::string& name, |
| 213 const std::string& context, | 217 const std::string& context, |
| 214 const std::string& value, | 218 const std::string& value, |
| 215 int item_index, | 219 int item_index, |
| 216 int item_count) | 220 int item_count) |
| 217 : AccessibilityControlInfo(profile, name), | 221 : AccessibilityControlInfo(profile, name), |
| 218 value_(value), | 222 value_(value), |
| 219 item_index_(item_index), | 223 item_index_(item_index), |
| 220 item_count_(item_count) { | 224 item_count_(item_count) { |
| 221 set_context(context); | 225 set_context(context); |
| 222 } | 226 } |
| 223 | 227 |
| 224 const char* AccessibilityListBoxInfo::type() const { | 228 const char* AccessibilityListBoxInfo::type() const { |
| 225 return keys::kTypeListBox; | 229 return keys::kTypeListBox; |
| 226 } | 230 } |
| 227 | 231 |
| 228 void AccessibilityListBoxInfo::SerializeToDict(DictionaryValue *dict) const { | 232 void AccessibilityListBoxInfo::SerializeToDict( |
| 233 base::DictionaryValue *dict) const { |
| 229 AccessibilityControlInfo::SerializeToDict(dict); | 234 AccessibilityControlInfo::SerializeToDict(dict); |
| 230 dict->SetString(keys::kValueKey, value_); | 235 dict->SetString(keys::kValueKey, value_); |
| 231 dict->SetInteger(keys::kItemIndexKey, item_index_); | 236 dict->SetInteger(keys::kItemIndexKey, item_index_); |
| 232 dict->SetInteger(keys::kItemCountKey, item_count_); | 237 dict->SetInteger(keys::kItemCountKey, item_count_); |
| 233 } | 238 } |
| 234 | 239 |
| 235 AccessibilityMenuInfo::AccessibilityMenuInfo(Profile* profile, | 240 AccessibilityMenuInfo::AccessibilityMenuInfo(Profile* profile, |
| 236 const std::string& menu_name) | 241 const std::string& menu_name) |
| 237 : AccessibilityControlInfo(profile, menu_name) { | 242 : AccessibilityControlInfo(profile, menu_name) { |
| 238 } | 243 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 251 has_submenu_(has_submenu), | 256 has_submenu_(has_submenu), |
| 252 item_index_(item_index), | 257 item_index_(item_index), |
| 253 item_count_(item_count) { | 258 item_count_(item_count) { |
| 254 set_context(context); | 259 set_context(context); |
| 255 } | 260 } |
| 256 | 261 |
| 257 const char* AccessibilityMenuItemInfo::type() const { | 262 const char* AccessibilityMenuItemInfo::type() const { |
| 258 return keys::kTypeMenuItem; | 263 return keys::kTypeMenuItem; |
| 259 } | 264 } |
| 260 | 265 |
| 261 void AccessibilityMenuItemInfo::SerializeToDict(DictionaryValue *dict) const { | 266 void AccessibilityMenuItemInfo::SerializeToDict( |
| 267 base::DictionaryValue *dict) const { |
| 262 AccessibilityControlInfo::SerializeToDict(dict); | 268 AccessibilityControlInfo::SerializeToDict(dict); |
| 263 dict->SetBoolean(keys::kHasSubmenuKey, has_submenu_); | 269 dict->SetBoolean(keys::kHasSubmenuKey, has_submenu_); |
| 264 dict->SetInteger(keys::kItemIndexKey, item_index_); | 270 dict->SetInteger(keys::kItemIndexKey, item_index_); |
| 265 dict->SetInteger(keys::kItemCountKey, item_count_); | 271 dict->SetInteger(keys::kItemCountKey, item_count_); |
| 266 } | 272 } |
| 267 | 273 |
| 268 AccessibilityTreeInfo::AccessibilityTreeInfo(Profile* profile, | 274 AccessibilityTreeInfo::AccessibilityTreeInfo(Profile* profile, |
| 269 const std::string& menu_name) | 275 const std::string& menu_name) |
| 270 : AccessibilityControlInfo(profile, menu_name) { | 276 : AccessibilityControlInfo(profile, menu_name) { |
| 271 } | 277 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 288 item_count_(item_count), | 294 item_count_(item_count), |
| 289 children_count_(children_count), | 295 children_count_(children_count), |
| 290 is_expanded_(is_expanded) { | 296 is_expanded_(is_expanded) { |
| 291 set_context(context); | 297 set_context(context); |
| 292 } | 298 } |
| 293 | 299 |
| 294 const char* AccessibilityTreeItemInfo::type() const { | 300 const char* AccessibilityTreeItemInfo::type() const { |
| 295 return keys::kTypeTreeItem; | 301 return keys::kTypeTreeItem; |
| 296 } | 302 } |
| 297 | 303 |
| 298 void AccessibilityTreeItemInfo::SerializeToDict(DictionaryValue *dict) const { | 304 void AccessibilityTreeItemInfo::SerializeToDict( |
| 305 base::DictionaryValue *dict) const { |
| 299 AccessibilityControlInfo::SerializeToDict(dict); | 306 AccessibilityControlInfo::SerializeToDict(dict); |
| 300 dict->SetInteger(keys::kItemDepthKey, item_depth_); | 307 dict->SetInteger(keys::kItemDepthKey, item_depth_); |
| 301 dict->SetInteger(keys::kItemIndexKey, item_index_); | 308 dict->SetInteger(keys::kItemIndexKey, item_index_); |
| 302 dict->SetInteger(keys::kItemCountKey, item_count_); | 309 dict->SetInteger(keys::kItemCountKey, item_count_); |
| 303 dict->SetInteger(keys::kChildrenCountKey, children_count_); | 310 dict->SetInteger(keys::kChildrenCountKey, children_count_); |
| 304 dict->SetBoolean(keys::kItemExpandedKey, is_expanded_); | 311 dict->SetBoolean(keys::kItemExpandedKey, is_expanded_); |
| 305 } | 312 } |
| 306 | 313 |
| 307 AccessibilitySliderInfo::AccessibilitySliderInfo(Profile* profile, | 314 AccessibilitySliderInfo::AccessibilitySliderInfo(Profile* profile, |
| 308 const std::string& name, | 315 const std::string& name, |
| 309 const std::string& context, | 316 const std::string& context, |
| 310 const std::string& value) | 317 const std::string& value) |
| 311 : AccessibilityControlInfo(profile, name), | 318 : AccessibilityControlInfo(profile, name), |
| 312 value_(value) { | 319 value_(value) { |
| 313 set_context(context); | 320 set_context(context); |
| 314 } | 321 } |
| 315 | 322 |
| 316 const char* AccessibilitySliderInfo::type() const { | 323 const char* AccessibilitySliderInfo::type() const { |
| 317 return keys::kTypeSlider; | 324 return keys::kTypeSlider; |
| 318 } | 325 } |
| 319 | 326 |
| 320 void AccessibilitySliderInfo::SerializeToDict(DictionaryValue *dict) const { | 327 void AccessibilitySliderInfo::SerializeToDict( |
| 328 base::DictionaryValue *dict) const { |
| 321 AccessibilityControlInfo::SerializeToDict(dict); | 329 AccessibilityControlInfo::SerializeToDict(dict); |
| 322 dict->SetString(keys::kStringValueKey, value_); | 330 dict->SetString(keys::kStringValueKey, value_); |
| 323 } | 331 } |
| 324 | 332 |
| 325 AccessibilityAlertInfo::AccessibilityAlertInfo(Profile* profile, | 333 AccessibilityAlertInfo::AccessibilityAlertInfo(Profile* profile, |
| 326 const std::string& name) | 334 const std::string& name) |
| 327 : AccessibilityControlInfo(profile, name) { | 335 : AccessibilityControlInfo(profile, name) { |
| 328 } | 336 } |
| 329 | 337 |
| 330 const char* AccessibilityAlertInfo::type() const { | 338 const char* AccessibilityAlertInfo::type() const { |
| 331 return keys::kTypeAlert; | 339 return keys::kTypeAlert; |
| 332 } | 340 } |
| OLD | NEW |