| 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 const EventListenerMap::ListenerList& listeners = | 171 const EventListenerMap::ListenerList& listeners = |
| 172 EventRouter::Get(browser_context_) | 172 EventRouter::Get(browser_context_) |
| 173 ->listeners() | 173 ->listeners() |
| 174 .GetEventListenersByName(event_name); | 174 .GetEventListenersByName(event_name); |
| 175 for (const auto& listener : listeners) { | 175 for (const auto& listener : listeners) { |
| 176 std::string extension_id = listener->extension_id(); | 176 std::string extension_id = listener->extension_id(); |
| 177 int connection_id = FindConnectionId(extension_id, connection); | 177 int connection_id = FindConnectionId(extension_id, connection); |
| 178 std::unique_ptr<base::ListValue> args_copy(args->DeepCopy()); | 178 std::unique_ptr<base::ListValue> args_copy(args->DeepCopy()); |
| 179 int connection_index = 0; | 179 int connection_index = 0; |
| 180 args_copy->Set(connection_index, | 180 args_copy->Set(connection_index, |
| 181 base::MakeUnique<base::FundamentalValue>(connection_id)); | 181 base::MakeUnique<base::Value>(connection_id)); |
| 182 std::unique_ptr<Event> event( | 182 std::unique_ptr<Event> event( |
| 183 new Event(histogram_value, event_name, std::move(args_copy))); | 183 new Event(histogram_value, event_name, std::move(args_copy))); |
| 184 EventRouter::Get(browser_context_) | 184 EventRouter::Get(browser_context_) |
| 185 ->DispatchEventToExtension(extension_id, std::move(event)); | 185 ->DispatchEventToExtension(extension_id, std::move(event)); |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 | 188 |
| 189 ApiResourceManager<EasyUnlockPrivateConnection>* | 189 ApiResourceManager<EasyUnlockPrivateConnection>* |
| 190 EasyUnlockPrivateConnectionManager::GetResourceManager() const { | 190 EasyUnlockPrivateConnectionManager::GetResourceManager() const { |
| 191 return ApiResourceManager<EasyUnlockPrivateConnection>::Get(browser_context_); | 191 return ApiResourceManager<EasyUnlockPrivateConnection>::Get(browser_context_); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 210 base::hash_set<int>* connection_ids = | 210 base::hash_set<int>* connection_ids = |
| 211 GetResourceManager()->GetResourceIds(extension_id); | 211 GetResourceManager()->GetResourceIds(extension_id); |
| 212 for (int connection_id : *connection_ids) { | 212 for (int connection_id : *connection_ids) { |
| 213 if (connection == GetConnection(extension_id, connection_id)) | 213 if (connection == GetConnection(extension_id, connection_id)) |
| 214 return connection_id; | 214 return connection_id; |
| 215 } | 215 } |
| 216 return 0; | 216 return 0; |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace extensions | 219 } // namespace extensions |
| OLD | NEW |