Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Side by Side Diff: chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc

Issue 2294653002: Some linked_ptr -> unique_ptr conversion in extensions/browser. (Closed)
Patch Set: address comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/bluetooth_low_energy/bluetooth_low_energ y_event_router.h" 5 #include "chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energ y_event_router.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1468 const std::string& event_name, 1468 const std::string& event_name,
1469 const device::BluetoothUUID& uuid, 1469 const device::BluetoothUUID& uuid,
1470 const std::string& characteristic_id, 1470 const std::string& characteristic_id,
1471 std::unique_ptr<base::ListValue> args) { 1471 std::unique_ptr<base::ListValue> args) {
1472 // Obtain the listeners of |event_name|. The list can contain multiple 1472 // Obtain the listeners of |event_name|. The list can contain multiple
1473 // entries for the same extension, so we keep track of the extensions that we 1473 // entries for the same extension, so we keep track of the extensions that we
1474 // already sent the event to, since we want the send an event to an extension 1474 // already sent the event to, since we want the send an event to an extension
1475 // only once. 1475 // only once.
1476 BluetoothPermissionRequest request(uuid.value()); 1476 BluetoothPermissionRequest request(uuid.value());
1477 std::set<std::string> handled_extensions; 1477 std::set<std::string> handled_extensions;
1478 const EventListenerMap::ListenerList listeners = 1478 const EventListenerMap::ListenerList& listeners =
1479 EventRouter::Get(browser_context_)->listeners().GetEventListenersByName( 1479 EventRouter::Get(browser_context_)
1480 event_name); 1480 ->listeners()
1481 .GetEventListenersByName(event_name);
1481 1482
1482 for (EventListenerMap::ListenerList::const_iterator iter = listeners.begin(); 1483 for (const std::unique_ptr<EventListener>& listener : listeners) {
1483 iter != listeners.end(); 1484 const std::string& extension_id = listener->extension_id();
1484 ++iter) {
1485 const std::string extension_id = (*iter)->extension_id();
1486 if (handled_extensions.find(extension_id) != handled_extensions.end()) 1485 if (handled_extensions.find(extension_id) != handled_extensions.end())
1487 continue; 1486 continue;
1488 1487
1489 handled_extensions.insert(extension_id); 1488 handled_extensions.insert(extension_id);
1490 1489
1491 const Extension* extension = 1490 const Extension* extension =
1492 ExtensionRegistry::Get(browser_context_) 1491 ExtensionRegistry::Get(browser_context_)
1493 ->GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING); 1492 ->GetExtensionById(extension_id, ExtensionRegistry::EVERYTHING);
1494 1493
1495 // For all API methods, the "low_energy" permission check is handled by 1494 // For all API methods, the "low_energy" permission check is handled by
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 requests_[extension_id] = std::move(new_request_id_map); 1919 requests_[extension_id] = std::move(new_request_id_map);
1921 } else { 1920 } else {
1922 request_id_map = iter->second.get(); 1921 request_id_map = iter->second.get();
1923 } 1922 }
1924 1923
1925 (*request_id_map)[++last_callback_request_id_] = std::move(request); 1924 (*request_id_map)[++last_callback_request_id_] = std::move(request);
1926 return last_callback_request_id_; 1925 return last_callback_request_id_;
1927 } 1926 }
1928 1927
1929 } // namespace extensions 1928 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698