| 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 <string> | 9 #include <string> |
| 9 #include <utility> | 10 #include <utility> |
| 10 | 11 |
| 11 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
| 15 #include "chrome/common/extensions/api/automation_api_constants.h" | 16 #include "chrome/common/extensions/api/automation_api_constants.h" |
| 16 #include "chrome/common/extensions/api/automation_internal.h" | 17 #include "chrome/common/extensions/api/automation_internal.h" |
| 17 #include "chrome/common/extensions/chrome_extension_messages.h" | 18 #include "chrome/common/extensions/chrome_extension_messages.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 content::RenderProcessHost::FromID(listener.process_id); | 103 content::RenderProcessHost::FromID(listener.process_id); |
| 103 rph->Send(new ExtensionMsg_AccessibilityLocationChange( | 104 rph->Send(new ExtensionMsg_AccessibilityLocationChange( |
| 104 listener.routing_id, | 105 listener.routing_id, |
| 105 params)); | 106 params)); |
| 106 } | 107 } |
| 107 } | 108 } |
| 108 | 109 |
| 109 void AutomationEventRouter::DispatchTreeDestroyedEvent( | 110 void AutomationEventRouter::DispatchTreeDestroyedEvent( |
| 110 int tree_id, | 111 int tree_id, |
| 111 content::BrowserContext* browser_context) { | 112 content::BrowserContext* browser_context) { |
| 113 browser_context = browser_context ? browser_context : active_profile_; |
| 112 std::unique_ptr<base::ListValue> args( | 114 std::unique_ptr<base::ListValue> args( |
| 113 api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id)); | 115 api::automation_internal::OnAccessibilityTreeDestroyed::Create(tree_id)); |
| 114 std::unique_ptr<Event> event(new Event( | 116 std::unique_ptr<Event> event(new Event( |
| 115 events::AUTOMATION_INTERNAL_ON_ACCESSIBILITY_TREE_DESTROYED, | 117 events::AUTOMATION_INTERNAL_ON_ACCESSIBILITY_TREE_DESTROYED, |
| 116 api::automation_internal::OnAccessibilityTreeDestroyed::kEventName, | 118 api::automation_internal::OnAccessibilityTreeDestroyed::kEventName, |
| 117 std::move(args))); | 119 std::move(args))); |
| 118 event->restrict_to_browser_context = browser_context; | 120 event->restrict_to_browser_context = browser_context; |
| 119 EventRouter::Get(browser_context)->BroadcastEvent(std::move(event)); | 121 EventRouter::Get(browser_context)->BroadcastEvent(std::move(event)); |
| 120 } | 122 } |
| 121 | 123 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // only mark one as active. | 207 // only mark one as active. |
| 206 listener.is_active_profile = (extension_id_count == 1 || | 208 listener.is_active_profile = (extension_id_count == 1 || |
| 207 rph->GetBrowserContext() == active_profile_); | 209 rph->GetBrowserContext() == active_profile_); |
| 208 #else | 210 #else |
| 209 listener.is_active_profile = true; | 211 listener.is_active_profile = true; |
| 210 #endif | 212 #endif |
| 211 } | 213 } |
| 212 } | 214 } |
| 213 | 215 |
| 214 } // namespace extensions | 216 } // namespace extensions |
| OLD | NEW |