| 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_EXTENSION_API_H_ | 5 #ifndef CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_API_H_ |
| 6 #define CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_API_H_ | 6 #define CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class ExtensionAccessibilityEventRouter { | 23 class ExtensionAccessibilityEventRouter { |
| 24 public: | 24 public: |
| 25 typedef base::Callback<void(ui::AccessibilityTypes::Event, | 25 typedef base::Callback<void(ui::AccessibilityTypes::Event, |
| 26 const AccessibilityControlInfo*)> | 26 const AccessibilityControlInfo*)> |
| 27 ControlEventCallback; | 27 ControlEventCallback; |
| 28 // Single instance of the event router. | 28 // Single instance of the event router. |
| 29 static ExtensionAccessibilityEventRouter* GetInstance(); | 29 static ExtensionAccessibilityEventRouter* GetInstance(); |
| 30 | 30 |
| 31 // Get the dict representing the last control that received an | 31 // Get the dict representing the last control that received an |
| 32 // OnControlFocus event. | 32 // OnControlFocus event. |
| 33 DictionaryValue* last_focused_control_dict() { | 33 base::DictionaryValue* last_focused_control_dict() { |
| 34 return &last_focused_control_dict_; | 34 return &last_focused_control_dict_; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Accessibility support is disabled until an extension expicitly enables | 37 // Accessibility support is disabled until an extension expicitly enables |
| 38 // it, so that this extension api has no impact on Chrome's performance | 38 // it, so that this extension api has no impact on Chrome's performance |
| 39 // otherwise. These methods handle enabling, disabling, and querying the | 39 // otherwise. These methods handle enabling, disabling, and querying the |
| 40 // status. | 40 // status. |
| 41 void SetAccessibilityEnabled(bool enabled); | 41 void SetAccessibilityEnabled(bool enabled); |
| 42 bool IsAccessibilityEnabled() const; | 42 bool IsAccessibilityEnabled() const; |
| 43 | 43 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 void OnControlFocused(const AccessibilityControlInfo* details); | 78 void OnControlFocused(const AccessibilityControlInfo* details); |
| 79 void OnControlAction(const AccessibilityControlInfo* details); | 79 void OnControlAction(const AccessibilityControlInfo* details); |
| 80 void OnTextChanged(const AccessibilityControlInfo* details); | 80 void OnTextChanged(const AccessibilityControlInfo* details); |
| 81 void OnMenuOpened(const AccessibilityMenuInfo* details); | 81 void OnMenuOpened(const AccessibilityMenuInfo* details); |
| 82 void OnMenuClosed(const AccessibilityMenuInfo* details); | 82 void OnMenuClosed(const AccessibilityMenuInfo* details); |
| 83 | 83 |
| 84 void DispatchEvent(Profile* profile, | 84 void DispatchEvent(Profile* profile, |
| 85 const char* event_name, | 85 const char* event_name, |
| 86 scoped_ptr<base::ListValue> event_args); | 86 scoped_ptr<base::ListValue> event_args); |
| 87 | 87 |
| 88 DictionaryValue last_focused_control_dict_; | 88 base::DictionaryValue last_focused_control_dict_; |
| 89 | 89 |
| 90 bool enabled_; | 90 bool enabled_; |
| 91 | 91 |
| 92 // For testing. | 92 // For testing. |
| 93 ControlEventCallback control_event_callback_; | 93 ControlEventCallback control_event_callback_; |
| 94 | 94 |
| 95 DISALLOW_COPY_AND_ASSIGN(ExtensionAccessibilityEventRouter); | 95 DISALLOW_COPY_AND_ASSIGN(ExtensionAccessibilityEventRouter); |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 // API function that enables or disables accessibility support. Event | 98 // API function that enables or disables accessibility support. Event |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 class AccessibilityGetAlertsForTabFunction | 131 class AccessibilityGetAlertsForTabFunction |
| 132 : public ChromeSyncExtensionFunction { | 132 : public ChromeSyncExtensionFunction { |
| 133 virtual ~AccessibilityGetAlertsForTabFunction() {} | 133 virtual ~AccessibilityGetAlertsForTabFunction() {} |
| 134 virtual bool RunImpl() OVERRIDE; | 134 virtual bool RunImpl() OVERRIDE; |
| 135 DECLARE_EXTENSION_FUNCTION( | 135 DECLARE_EXTENSION_FUNCTION( |
| 136 "experimental.accessibility.getAlertsForTab", | 136 "experimental.accessibility.getAlertsForTab", |
| 137 EXPERIMENTAL_ACCESSIBILITY_GETALERTSFORTAB) | 137 EXPERIMENTAL_ACCESSIBILITY_GETALERTSFORTAB) |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 #endif // CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_API_H_ | 140 #endif // CHROME_BROWSER_ACCESSIBILITY_ACCESSIBILITY_EXTENSION_API_H_ |
| OLD | NEW |