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

Side by Side Diff: device/usb/mock_usb_service.cc

Issue 2688303002: Add a feature flag for the new Windows USB backend. (Closed)
Patch Set: Update histograms. Created 3 years, 10 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
« no previous file with comments | « device/usb/BUILD.gn ('k') | device/usb/usb_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "device/usb/mock_usb_service.h" 5 #include "device/usb/mock_usb_service.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
11 #include "device/usb/usb_device.h" 11 #include "device/usb/usb_device.h"
12 12
13 namespace device { 13 namespace device {
14 14
15 MockUsbService::MockUsbService() 15 MockUsbService::MockUsbService() : UsbService(nullptr) {}
16 : UsbService(base::ThreadTaskRunnerHandle::IsSet()
17 ? base::ThreadTaskRunnerHandle::Get()
18 : nullptr,
19 nullptr) {}
20 16
21 MockUsbService::~MockUsbService() { 17 MockUsbService::~MockUsbService() {
22 // Shutdown() must be called before the base class destructor. 18 // Shutdown() must be called before the base class destructor.
23 Shutdown(); 19 Shutdown();
24 } 20 }
25 21
26 void MockUsbService::AddDevice(scoped_refptr<UsbDevice> device) { 22 void MockUsbService::AddDevice(scoped_refptr<UsbDevice> device) {
27 devices()[device->guid()] = device; 23 devices()[device->guid()] = device;
28 NotifyDeviceAdded(device); 24 NotifyDeviceAdded(device);
29 } 25 }
30 26
31 void MockUsbService::RemoveDevice(scoped_refptr<UsbDevice> device) { 27 void MockUsbService::RemoveDevice(scoped_refptr<UsbDevice> device) {
32 devices().erase(device->guid()); 28 devices().erase(device->guid());
33 UsbService::NotifyDeviceRemoved(device); 29 UsbService::NotifyDeviceRemoved(device);
34 } 30 }
35 31
36 } // namespace device 32 } // namespace device
OLDNEW
« no previous file with comments | « device/usb/BUILD.gn ('k') | device/usb/usb_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698