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

Side by Side Diff: device/usb/usb_service.h

Issue 497363004: Merge components/usb_service into device/usb. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 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
« no previous file with comments | « device/usb/usb_interface_impl.cc ('k') | device/usb/usb_service_impl.cc » ('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 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 #ifndef COMPONENTS_USB_SERVICE_USB_SERVICE_H_ 5 #ifndef DEVICE_USB_USB_SERVICE_H_
6 #define COMPONENTS_USB_SERVICE_USB_SERVICE_H_ 6 #define DEVICE_USB_USB_SERVICE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/threading/non_thread_safe.h" 12 #include "base/threading/non_thread_safe.h"
13 #include "components/usb_service/usb_service_export.h"
14 13
15 namespace base { 14 namespace base {
16 class SingleThreadTaskRunner; 15 class SingleThreadTaskRunner;
17 } 16 }
18 17
19 namespace usb_service { 18 namespace device {
20 19
21 class UsbDevice; 20 class UsbDevice;
22 21
23 // The USB service handles creating and managing an event handler thread that is 22 // The USB service handles creating and managing an event handler thread that is
24 // used to manage and dispatch USB events. It is also responsible for device 23 // used to manage and dispatch USB events. It is also responsible for device
25 // discovery on the system, which allows it to re-use device handles to prevent 24 // discovery on the system, which allows it to re-use device handles to prevent
26 // competition for the same USB device. 25 // competition for the same USB device.
27 class USB_SERVICE_EXPORT UsbService : public base::NonThreadSafe { 26 class UsbService : public base::NonThreadSafe {
28 public: 27 public:
29 // Must be called on a thread with a MessageLoopForIO (for example 28 // Must be called on a thread with a MessageLoopForIO (for example
30 // BrowserThread::FILE). The UI task runner reference is used to talk to the 29 // BrowserThread::FILE). The UI task runner reference is used to talk to the
31 // PermissionBrokerClient on ChromeOS (UI thread). Returns NULL when 30 // PermissionBrokerClient on ChromeOS (UI thread). Returns NULL when
32 // initialization fails. 31 // initialization fails.
33 static UsbService* GetInstance( 32 static UsbService* GetInstance(
34 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); 33 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
35 34
36 static void SetInstanceForTest(UsbService* instance); 35 static void SetInstanceForTest(UsbService* instance);
37 36
38 virtual scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id) = 0; 37 virtual scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id) = 0;
39 38
40 // Get all of the devices attached to the system, inserting them into 39 // Get all of the devices attached to the system, inserting them into
41 // |devices|. Clears |devices| before use. The result will be sorted by id 40 // |devices|. Clears |devices| before use. The result will be sorted by id
42 // in increasing order. Must be called on FILE thread. 41 // in increasing order. Must be called on FILE thread.
43 virtual void GetDevices(std::vector<scoped_refptr<UsbDevice> >* devices) = 0; 42 virtual void GetDevices(std::vector<scoped_refptr<UsbDevice> >* devices) = 0;
44 43
45 protected: 44 protected:
46 friend struct base::DefaultDeleter<UsbService>; 45 friend struct base::DefaultDeleter<UsbService>;
47 UsbService() {} 46 UsbService() {}
48 virtual ~UsbService() {} 47 virtual ~UsbService() {}
49 DISALLOW_COPY_AND_ASSIGN(UsbService); 48 DISALLOW_COPY_AND_ASSIGN(UsbService);
50 }; 49 };
51 50
52 } // namespace usb_service 51 } // namespace device
53 52
54 #endif // COMPONENTS_USB_SERVICE_USB_SERVICE_H_ 53 #endif // DEVICE_USB_USB_SERVICE_H_
OLDNEW
« no previous file with comments | « device/usb/usb_interface_impl.cc ('k') | device/usb/usb_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698