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

Side by Side Diff: extensions/browser/api/hid/hid_device_manager.cc

Issue 2236443003: extensions: Use stl utilities from the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't add braces Created 4 years, 4 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 "extensions/browser/api/hid/hid_device_manager.h" 5 #include "extensions/browser/api/hid/hid_device_manager.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <limits> 9 #include <limits>
10 #include <utility> 10 #include <utility>
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 } 210 }
211 211
212 void HidDeviceManager::OnListenerAdded(const EventListenerInfo& details) { 212 void HidDeviceManager::OnListenerAdded(const EventListenerInfo& details) {
213 LazyInitialize(); 213 LazyInitialize();
214 } 214 }
215 215
216 void HidDeviceManager::OnDeviceAdded(scoped_refptr<HidDeviceInfo> device_info) { 216 void HidDeviceManager::OnDeviceAdded(scoped_refptr<HidDeviceInfo> device_info) {
217 DCHECK(thread_checker_.CalledOnValidThread()); 217 DCHECK(thread_checker_.CalledOnValidThread());
218 DCHECK_LT(next_resource_id_, std::numeric_limits<int>::max()); 218 DCHECK_LT(next_resource_id_, std::numeric_limits<int>::max());
219 int new_id = next_resource_id_++; 219 int new_id = next_resource_id_++;
220 DCHECK(!ContainsKey(resource_ids_, device_info->device_id())); 220 DCHECK(!base::ContainsKey(resource_ids_, device_info->device_id()));
221 resource_ids_[device_info->device_id()] = new_id; 221 resource_ids_[device_info->device_id()] = new_id;
222 device_ids_[new_id] = device_info->device_id(); 222 device_ids_[new_id] = device_info->device_id();
223 223
224 // Don't generate events during the initial enumeration. 224 // Don't generate events during the initial enumeration.
225 if (enumeration_ready_ && event_router_) { 225 if (enumeration_ready_ && event_router_) {
226 api::hid::HidDeviceInfo api_device_info; 226 api::hid::HidDeviceInfo api_device_info;
227 api_device_info.device_id = new_id; 227 api_device_info.device_id = new_id;
228 PopulateHidDeviceInfo(&api_device_info, device_info); 228 PopulateHidDeviceInfo(&api_device_info, device_info);
229 229
230 if (api_device_info.collections.size() > 0) { 230 if (api_device_info.collections.size() > 0) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 std::unique_ptr<base::ListValue> event_args, 335 std::unique_ptr<base::ListValue> event_args,
336 scoped_refptr<HidDeviceInfo> device_info) { 336 scoped_refptr<HidDeviceInfo> device_info) {
337 std::unique_ptr<Event> event( 337 std::unique_ptr<Event> event(
338 new Event(histogram_value, event_name, std::move(event_args))); 338 new Event(histogram_value, event_name, std::move(event_args)));
339 event->will_dispatch_callback = base::Bind( 339 event->will_dispatch_callback = base::Bind(
340 &WillDispatchDeviceEvent, weak_factory_.GetWeakPtr(), device_info); 340 &WillDispatchDeviceEvent, weak_factory_.GetWeakPtr(), device_info);
341 event_router_->BroadcastEvent(std::move(event)); 341 event_router_->BroadcastEvent(std::move(event));
342 } 342 }
343 343
344 } // namespace extensions 344 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698