| 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 | 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" |
| 11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
| 14 #include "content/public/browser/notification_types.h" | 14 #include "content/public/browser/notification_types.h" |
| 15 | 15 |
| 16 namespace keys = extension_accessibility_api_constants; | 16 namespace keys = extension_accessibility_api_constants; |
| 17 | 17 |
| 18 void SendAccessibilityNotification(int type, AccessibilityEventInfo* info) { | 18 void SendControlAccessibilityNotification( |
| 19 ui::AccessibilityTypes::Event event, |
| 20 AccessibilityControlInfo* info) { |
| 19 Profile *profile = info->profile(); | 21 Profile *profile = info->profile(); |
| 20 if (profile->ShouldSendAccessibilityEvents()) { | 22 if (profile->ShouldSendAccessibilityEvents()) { |
| 21 content::NotificationService::current()->Notify( | 23 ExtensionAccessibilityEventRouter::GetInstance()->HandleControlEvent( |
| 22 type, | 24 event, |
| 23 content::Source<Profile>(profile), | 25 info); |
| 24 content::Details<AccessibilityEventInfo>(info)); | |
| 25 } | 26 } |
| 26 } | 27 } |
| 27 | 28 |
| 29 void SendMenuAccessibilityNotification( |
| 30 ui::AccessibilityTypes::Event event, |
| 31 AccessibilityMenuInfo* info) { |
| 32 Profile *profile = info->profile(); |
| 33 if (profile->ShouldSendAccessibilityEvents()) { |
| 34 ExtensionAccessibilityEventRouter::GetInstance()->HandleMenuEvent( |
| 35 event, |
| 36 info); |
| 37 } |
| 38 } |
| 39 |
| 40 void SendWindowAccessibilityNotification( |
| 41 ui::AccessibilityTypes::Event event, |
| 42 AccessibilityWindowInfo* info) { |
| 43 Profile *profile = info->profile(); |
| 44 if (profile->ShouldSendAccessibilityEvents()) { |
| 45 ExtensionAccessibilityEventRouter::GetInstance()->HandleWindowEvent( |
| 46 event, |
| 47 info); |
| 48 } |
| 49 } |
| 50 |
| 51 |
| 28 AccessibilityControlInfo::AccessibilityControlInfo( | 52 AccessibilityControlInfo::AccessibilityControlInfo( |
| 29 Profile* profile, const std::string& name) | 53 Profile* profile, const std::string& name) |
| 30 : AccessibilityEventInfo(profile), | 54 : AccessibilityEventInfo(profile), |
| 31 name_(name) { | 55 name_(name) { |
| 32 } | 56 } |
| 33 | 57 |
| 34 AccessibilityControlInfo::~AccessibilityControlInfo() { | 58 AccessibilityControlInfo::~AccessibilityControlInfo() { |
| 35 } | 59 } |
| 36 | 60 |
| 37 void AccessibilityControlInfo::SerializeToDict(DictionaryValue *dict) const { | 61 void AccessibilityControlInfo::SerializeToDict(DictionaryValue *dict) const { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 } | 275 } |
| 252 | 276 |
| 253 const char* AccessibilitySliderInfo::type() const { | 277 const char* AccessibilitySliderInfo::type() const { |
| 254 return keys::kTypeSlider; | 278 return keys::kTypeSlider; |
| 255 } | 279 } |
| 256 | 280 |
| 257 void AccessibilitySliderInfo::SerializeToDict(DictionaryValue *dict) const { | 281 void AccessibilitySliderInfo::SerializeToDict(DictionaryValue *dict) const { |
| 258 AccessibilityControlInfo::SerializeToDict(dict); | 282 AccessibilityControlInfo::SerializeToDict(dict); |
| 259 dict->SetString(keys::kStringValueKey, value_); | 283 dict->SetString(keys::kStringValueKey, value_); |
| 260 } | 284 } |
| OLD | NEW |