| 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 #include "chrome/browser/extensions/api/automation_internal/automation_event_rou
ter.h" | 5 #include "chrome/browser/extensions/api/automation_internal/automation_event_rou
ter.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 content::RenderProcessHost* rph = | 83 content::RenderProcessHost* rph = |
| 84 content::RenderProcessHost::FromID(listener.process_id); | 84 content::RenderProcessHost::FromID(listener.process_id); |
| 85 rph->Send(new ExtensionMsg_AccessibilityEvent(listener.routing_id, | 85 rph->Send(new ExtensionMsg_AccessibilityEvent(listener.routing_id, |
| 86 params, | 86 params, |
| 87 listener.is_active_profile)); | 87 listener.is_active_profile)); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 void AutomationEventRouter::DispatchAccessibilityLocationChange( |
| 92 const ExtensionMsg_AccessibilityLocationChangeParams& params) { |
| 93 for (const auto& listener : listeners_) { |
| 94 // Skip listeners that don't want to listen to this tree. |
| 95 if (!listener.desktop && |
| 96 listener.tree_ids.find(params.tree_id) == listener.tree_ids.end()) { |
| 97 continue; |
| 98 } |
| 99 |
| 100 content::RenderProcessHost* rph = |
| 101 content::RenderProcessHost::FromID(listener.process_id); |
| 102 rph->Send(new ExtensionMsg_AccessibilityLocationChange( |
| 103 listener.routing_id, |
| 104 params)); |
| 105 } |
| 106 } |
| 107 |
| 91 void AutomationEventRouter::DispatchTreeDestroyedEvent( | 108 void AutomationEventRouter::DispatchTreeDestroyedEvent( |
| 92 int tree_id, | 109 int tree_id, |
| 93 content::BrowserContext* browser_context) { | 110 content::BrowserContext* browser_context) { |
| 94 std::unique_ptr<base::ListValue> args( | 111 std::unique_ptr<base::ListValue> args( |
| 95 api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id)); | 112 api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id)); |
| 96 std::unique_ptr<Event> event(new Event( | 113 std::unique_ptr<Event> event(new Event( |
| 97 events::AUTOMATION_INTERNAL_ON_ACCESSIBILITY_TREE_DESTROYED, | 114 events::AUTOMATION_INTERNAL_ON_ACCESSIBILITY_TREE_DESTROYED, |
| 98 api::automation_internal::OnAccessibilityTreeDestroyed::kEventName, | 115 api::automation_internal::OnAccessibilityTreeDestroyed::kEventName, |
| 99 std::move(args))); | 116 std::move(args))); |
| 100 event->restrict_to_browser_context = browser_context; | 117 event->restrict_to_browser_context = browser_context; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // only mark one as active. | 204 // only mark one as active. |
| 188 listener.is_active_profile = (extension_id_count == 1 || | 205 listener.is_active_profile = (extension_id_count == 1 || |
| 189 rph->GetBrowserContext() == active_profile_); | 206 rph->GetBrowserContext() == active_profile_); |
| 190 #else | 207 #else |
| 191 listener.is_active_profile = true; | 208 listener.is_active_profile = true; |
| 192 #endif | 209 #endif |
| 193 } | 210 } |
| 194 } | 211 } |
| 195 | 212 |
| 196 } // namespace extensions | 213 } // namespace extensions |
| OLD | NEW |