| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_API_AUTOMATION_INTERNAL_AUTOMATION_EVENT_ROUTE
R_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_EVENT_ROUTE
R_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_EVENT_ROUTE
R_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_EVENT_ROUTE
R_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "chrome/common/extensions/api/automation_internal.h" | 13 #include "chrome/common/extensions/api/automation_internal.h" |
| 14 #include "content/public/browser/ax_event_notification_details.h" | 14 #include "content/public/browser/ax_event_notification_details.h" |
| 15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 17 #include "extensions/common/extension_id.h" | 17 #include "extensions/common/extension_id.h" |
| 18 | 18 |
| 19 class Profile; | 19 class Profile; |
| 20 | 20 |
| 21 namespace content { | 21 namespace content { |
| 22 class BrowserContext; | 22 class BrowserContext; |
| 23 } // namespace content | 23 } // namespace content |
| 24 | 24 |
| 25 struct ExtensionMsg_AccessibilityEventParams; | 25 struct ExtensionMsg_AccessibilityEventParams; |
| 26 struct ExtensionMsg_AccessibilityLocationChangeParams; |
| 26 | 27 |
| 27 namespace extensions { | 28 namespace extensions { |
| 28 struct AutomationListener; | 29 struct AutomationListener; |
| 29 class Extension; | 30 class Extension; |
| 30 | 31 |
| 31 class AutomationEventRouter : public content::NotificationObserver { | 32 class AutomationEventRouter : public content::NotificationObserver { |
| 32 public: | 33 public: |
| 33 static AutomationEventRouter* GetInstance(); | 34 static AutomationEventRouter* GetInstance(); |
| 34 | 35 |
| 35 // Indicates that the listener at |listener_process_id|, |listener_routing_id| | 36 // Indicates that the listener at |listener_process_id|, |listener_routing_id| |
| 36 // wants to receive automation events from the accessibility tree indicated | 37 // wants to receive automation events from the accessibility tree indicated |
| 37 // by |source_ax_tree_id|. Automation events are forwarded from now on | 38 // by |source_ax_tree_id|. Automation events are forwarded from now on |
| 38 // until the listener process dies. | 39 // until the listener process dies. |
| 39 void RegisterListenerForOneTree(const ExtensionId& extension_id, | 40 void RegisterListenerForOneTree(const ExtensionId& extension_id, |
| 40 int listener_process_id, | 41 int listener_process_id, |
| 41 int listener_routing_id, | 42 int listener_routing_id, |
| 42 int source_ax_tree_id); | 43 int source_ax_tree_id); |
| 43 | 44 |
| 44 // Indicates that the listener at |listener_process_id|, |listener_routing_id| | 45 // Indicates that the listener at |listener_process_id|, |listener_routing_id| |
| 45 // wants to receive automation events from all accessibility trees because | 46 // wants to receive automation events from all accessibility trees because |
| 46 // it has Desktop permission. | 47 // it has Desktop permission. |
| 47 void RegisterListenerWithDesktopPermission(const ExtensionId& extension_id, | 48 void RegisterListenerWithDesktopPermission(const ExtensionId& extension_id, |
| 48 int listener_process_id, | 49 int listener_process_id, |
| 49 int listener_routing_id); | 50 int listener_routing_id); |
| 50 | 51 |
| 51 void DispatchAccessibilityEvent( | 52 void DispatchAccessibilityEvent( |
| 52 const ExtensionMsg_AccessibilityEventParams& params); | 53 const ExtensionMsg_AccessibilityEventParams& params); |
| 53 | 54 |
| 55 void DispatchAccessibilityLocationChange( |
| 56 const ExtensionMsg_AccessibilityLocationChangeParams& params); |
| 57 |
| 54 // Notify all automation extensions that an accessibility tree was | 58 // Notify all automation extensions that an accessibility tree was |
| 55 // destroyed. If |browser_context| is null, | 59 // destroyed. If |browser_context| is null, |
| 56 void DispatchTreeDestroyedEvent( | 60 void DispatchTreeDestroyedEvent( |
| 57 int tree_id, | 61 int tree_id, |
| 58 content::BrowserContext* browser_context); | 62 content::BrowserContext* browser_context); |
| 59 | 63 |
| 60 private: | 64 private: |
| 61 struct AutomationListener { | 65 struct AutomationListener { |
| 62 AutomationListener(); | 66 AutomationListener(); |
| 63 AutomationListener(const AutomationListener& other); | 67 AutomationListener(const AutomationListener& other); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 Profile* active_profile_; | 108 Profile* active_profile_; |
| 105 | 109 |
| 106 friend struct base::DefaultSingletonTraits<AutomationEventRouter>; | 110 friend struct base::DefaultSingletonTraits<AutomationEventRouter>; |
| 107 | 111 |
| 108 DISALLOW_COPY_AND_ASSIGN(AutomationEventRouter); | 112 DISALLOW_COPY_AND_ASSIGN(AutomationEventRouter); |
| 109 }; | 113 }; |
| 110 | 114 |
| 111 } // namespace extensions | 115 } // namespace extensions |
| 112 | 116 |
| 113 #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_EVENT_RO
UTER_H_ | 117 #endif // CHROME_BROWSER_EXTENSIONS_API_AUTOMATION_INTERNAL_AUTOMATION_EVENT_RO
UTER_H_ |
| OLD | NEW |