| 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/easy_unlock_private/easy_unlock_private_
connection_manager.h" | 5 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_
connection_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 const EventListenerMap::ListenerList& listeners = | 156 const EventListenerMap::ListenerList& listeners = |
| 157 EventRouter::Get(browser_context_) | 157 EventRouter::Get(browser_context_) |
| 158 ->listeners() | 158 ->listeners() |
| 159 .GetEventListenersByName(event_name); | 159 .GetEventListenersByName(event_name); |
| 160 for (const auto& listener : listeners) { | 160 for (const auto& listener : listeners) { |
| 161 std::string extension_id = listener->extension_id(); | 161 std::string extension_id = listener->extension_id(); |
| 162 int connection_id = FindConnectionId(extension_id, connection); | 162 int connection_id = FindConnectionId(extension_id, connection); |
| 163 std::unique_ptr<base::ListValue> args_copy(args->DeepCopy()); | 163 std::unique_ptr<base::ListValue> args_copy(args->DeepCopy()); |
| 164 int connection_index = 0; | 164 int connection_index = 0; |
| 165 args_copy->Set(connection_index, | 165 args_copy->Set(connection_index, |
| 166 base::MakeUnique<base::FundamentalValue>(connection_id)); | 166 base::MakeUnique<base::Value>(connection_id)); |
| 167 std::unique_ptr<Event> event( | 167 std::unique_ptr<Event> event( |
| 168 new Event(histogram_value, event_name, std::move(args_copy))); | 168 new Event(histogram_value, event_name, std::move(args_copy))); |
| 169 EventRouter::Get(browser_context_) | 169 EventRouter::Get(browser_context_) |
| 170 ->DispatchEventToExtension(extension_id, std::move(event)); | 170 ->DispatchEventToExtension(extension_id, std::move(event)); |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 ApiResourceManager<EasyUnlockPrivateConnection>* | 174 ApiResourceManager<EasyUnlockPrivateConnection>* |
| 175 EasyUnlockPrivateConnectionManager::GetResourceManager() const { | 175 EasyUnlockPrivateConnectionManager::GetResourceManager() const { |
| 176 return ApiResourceManager<EasyUnlockPrivateConnection>::Get(browser_context_); | 176 return ApiResourceManager<EasyUnlockPrivateConnection>::Get(browser_context_); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 195 base::hash_set<int>* connection_ids = | 195 base::hash_set<int>* connection_ids = |
| 196 GetResourceManager()->GetResourceIds(extension_id); | 196 GetResourceManager()->GetResourceIds(extension_id); |
| 197 for (int connection_id : *connection_ids) { | 197 for (int connection_id : *connection_ids) { |
| 198 if (connection == GetConnection(extension_id, connection_id)) | 198 if (connection == GetConnection(extension_id, connection_id)) |
| 199 return connection_id; | 199 return connection_id; |
| 200 } | 200 } |
| 201 return 0; | 201 return 0; |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace extensions | 204 } // namespace extensions |
| OLD | NEW |