| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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()) | 113 if (listeners_.empty()) |
| 114 return; | 114 return; |
| 115 | 115 |
| 116 browser_context = browser_context ? browser_context : active_profile_; | 116 browser_context = browser_context ? browser_context : active_profile_; |
| 117 std::unique_ptr<base::ListValue> args( | 117 std::unique_ptr<base::ListValue> args( |
| 118 api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id)); | 118 api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id)); |
| 119 std::unique_ptr<Event> event(new Event( | 119 auto event = base::MakeUnique<Event>( |
| 120 events::AUTOMATION_INTERNAL_ON_ACCESSIBILITY_TREE_DESTROYED, | 120 events::AUTOMATION_INTERNAL_ON_ACCESSIBILITY_TREE_DESTROYED, |
| 121 api::automation_internal::OnAccessibilityTreeDestroyed::kEventName, | 121 api::automation_internal::OnAccessibilityTreeDestroyed::kEventName, |
| 122 std::move(args))); | 122 std::move(args), browser_context); |
| 123 event->restrict_to_browser_context = browser_context; | |
| 124 EventRouter::Get(browser_context)->BroadcastEvent(std::move(event)); | 123 EventRouter::Get(browser_context)->BroadcastEvent(std::move(event)); |
| 125 } | 124 } |
| 126 | 125 |
| 127 AutomationEventRouter::AutomationListener::AutomationListener() { | 126 AutomationEventRouter::AutomationListener::AutomationListener() { |
| 128 } | 127 } |
| 129 | 128 |
| 130 AutomationEventRouter::AutomationListener::AutomationListener( | 129 AutomationEventRouter::AutomationListener::AutomationListener( |
| 131 const AutomationListener& other) = default; | 130 const AutomationListener& other) = default; |
| 132 | 131 |
| 133 AutomationEventRouter::AutomationListener::~AutomationListener() { | 132 AutomationEventRouter::AutomationListener::~AutomationListener() { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // only mark one as active. | 209 // only mark one as active. |
| 211 listener.is_active_profile = (extension_id_count == 1 || | 210 listener.is_active_profile = (extension_id_count == 1 || |
| 212 rph->GetBrowserContext() == active_profile_); | 211 rph->GetBrowserContext() == active_profile_); |
| 213 #else | 212 #else |
| 214 listener.is_active_profile = true; | 213 listener.is_active_profile = true; |
| 215 #endif | 214 #endif |
| 216 } | 215 } |
| 217 } | 216 } |
| 218 | 217 |
| 219 } // namespace extensions | 218 } // namespace extensions |
| OLD | NEW |