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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 content::RenderProcessHost::FromID(listener.process_id); | 103 content::RenderProcessHost::FromID(listener.process_id); |
104 rph->Send(new ExtensionMsg_AccessibilityLocationChange( | 104 rph->Send(new ExtensionMsg_AccessibilityLocationChange( |
105 listener.routing_id, | 105 listener.routing_id, |
106 params)); | 106 params)); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 void AutomationEventRouter::DispatchTreeDestroyedEvent( | 110 void AutomationEventRouter::DispatchTreeDestroyedEvent( |
111 int tree_id, | 111 int tree_id, |
112 content::BrowserContext* browser_context) { | 112 content::BrowserContext* browser_context) { |
| 113 if (listeners_.empty()) |
| 114 return; |
| 115 |
113 browser_context = browser_context ? browser_context : active_profile_; | 116 browser_context = browser_context ? browser_context : active_profile_; |
114 std::unique_ptr<base::ListValue> args( | 117 std::unique_ptr<base::ListValue> args( |
115 api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id)); | 118 api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id)); |
116 std::unique_ptr<Event> event(new Event( | 119 std::unique_ptr<Event> event(new Event( |
117 events::AUTOMATION_INTERNAL_ON_ACCESSIBILITY_TREE_DESTROYED, | 120 events::AUTOMATION_INTERNAL_ON_ACCESSIBILITY_TREE_DESTROYED, |
118 api::automation_internal::OnAccessibilityTreeDestroyed::kEventName, | 121 api::automation_internal::OnAccessibilityTreeDestroyed::kEventName, |
119 std::move(args))); | 122 std::move(args))); |
120 event->restrict_to_browser_context = browser_context; | 123 event->restrict_to_browser_context = browser_context; |
121 EventRouter::Get(browser_context)->BroadcastEvent(std::move(event)); | 124 EventRouter::Get(browser_context)->BroadcastEvent(std::move(event)); |
122 } | 125 } |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // only mark one as active. | 210 // only mark one as active. |
208 listener.is_active_profile = (extension_id_count == 1 || | 211 listener.is_active_profile = (extension_id_count == 1 || |
209 rph->GetBrowserContext() == active_profile_); | 212 rph->GetBrowserContext() == active_profile_); |
210 #else | 213 #else |
211 listener.is_active_profile = true; | 214 listener.is_active_profile = true; |
212 #endif | 215 #endif |
213 } | 216 } |
214 } | 217 } |
215 | 218 |
216 } // namespace extensions | 219 } // namespace extensions |
OLD | NEW |