| OLD | NEW |
| 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_EXTENSIONS_EXTENSION_ACCESSIBILITY_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_ACCESSIBILITY_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACCESSIBILITY_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_ACCESSIBILITY_API_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/callback_old.h" | 12 #include "base/callback_old.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
| 15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "chrome/browser/accessibility_events.h" | 16 #include "chrome/browser/accessibility_events.h" |
| 17 #include "chrome/browser/extensions/extension_function.h" | 17 #include "chrome/browser/extensions/extension_function.h" |
| 18 #include "content/common/notification_observer.h" | 18 #include "content/common/notification_observer.h" |
| 19 #include "content/common/notification_registrar.h" | 19 #include "content/common/notification_registrar.h" |
| 20 | 20 |
| 21 // Observes the profile and routes accessibility notifications as events | 21 // Observes the profile and routes accessibility notifications as events |
| 22 // to the extension system. | 22 // to the extension system. |
| 23 class ExtensionAccessibilityEventRouter : public NotificationObserver { | 23 class ExtensionAccessibilityEventRouter : public NotificationObserver { |
| 24 public: | 24 public: |
| 25 // Single instance of the event router. | 25 // Single instance of the event router. |
| 26 static ExtensionAccessibilityEventRouter* GetInstance(); | 26 static ExtensionAccessibilityEventRouter* GetInstance(); |
| 27 | 27 |
| 28 // Safe to call multiple times. | |
| 29 void ObserveProfile(Profile* profile); | |
| 30 | |
| 31 // Get the dict representing the last control that received an | 28 // Get the dict representing the last control that received an |
| 32 // OnControlFocus event. | 29 // OnControlFocus event. |
| 33 DictionaryValue* last_focused_control_dict() { | 30 DictionaryValue* last_focused_control_dict() { |
| 34 return &last_focused_control_dict_; | 31 return &last_focused_control_dict_; |
| 35 } | 32 } |
| 36 | 33 |
| 37 // Accessibility support is disabled until an extension expicitly enables | 34 // Accessibility support is disabled until an extension expicitly enables |
| 38 // it, so that this extension api has no impact on Chrome's performance | 35 // it, so that this extension api has no impact on Chrome's performance |
| 39 // otherwise. These methods handle enabling, disabling, querying the | 36 // otherwise. These methods handle enabling, disabling, querying the |
| 40 // status, and installing callbacks to execute when accessibility support | 37 // status, and installing callbacks to execute when accessibility support |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 | 90 |
| 94 // API function that returns the most recent focused control. | 91 // API function that returns the most recent focused control. |
| 95 class GetFocusedControlFunction : public SyncExtensionFunction { | 92 class GetFocusedControlFunction : public SyncExtensionFunction { |
| 96 virtual ~GetFocusedControlFunction() {} | 93 virtual ~GetFocusedControlFunction() {} |
| 97 virtual bool RunImpl() OVERRIDE; | 94 virtual bool RunImpl() OVERRIDE; |
| 98 DECLARE_EXTENSION_FUNCTION_NAME( | 95 DECLARE_EXTENSION_FUNCTION_NAME( |
| 99 "experimental.accessibility.getFocusedControl") | 96 "experimental.accessibility.getFocusedControl") |
| 100 }; | 97 }; |
| 101 | 98 |
| 102 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACCESSIBILITY_API_H_ | 99 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_ACCESSIBILITY_API_H_ |
| OLD | NEW |