| OLD | NEW |
| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 | 107 |
| 108 HidDeviceManager::~HidDeviceManager() { | 108 HidDeviceManager::~HidDeviceManager() { |
| 109 DCHECK(thread_checker_.CalledOnValidThread()); | 109 DCHECK(thread_checker_.CalledOnValidThread()); |
| 110 } | 110 } |
| 111 | 111 |
| 112 // static | 112 // static |
| 113 BrowserContextKeyedAPIFactory<HidDeviceManager>* | 113 BrowserContextKeyedAPIFactory<HidDeviceManager>* |
| 114 HidDeviceManager::GetFactoryInstance() { | 114 HidDeviceManager::GetFactoryInstance() { |
| 115 static base::LazyInstance<BrowserContextKeyedAPIFactory<HidDeviceManager> > | 115 static base::LazyInstance<BrowserContextKeyedAPIFactory<HidDeviceManager>>:: |
| 116 factory = LAZY_INSTANCE_INITIALIZER; | 116 DestructorAtExit factory = LAZY_INSTANCE_INITIALIZER; |
| 117 return &factory.Get(); | 117 return &factory.Get(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void HidDeviceManager::GetApiDevices( | 120 void HidDeviceManager::GetApiDevices( |
| 121 const Extension* extension, | 121 const Extension* extension, |
| 122 const std::vector<HidDeviceFilter>& filters, | 122 const std::vector<HidDeviceFilter>& filters, |
| 123 const GetApiDevicesCallback& callback) { | 123 const GetApiDevicesCallback& callback) { |
| 124 DCHECK(thread_checker_.CalledOnValidThread()); | 124 DCHECK(thread_checker_.CalledOnValidThread()); |
| 125 LazyInitialize(); | 125 LazyInitialize(); |
| 126 | 126 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |