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

Side by Side Diff: components/usb_service/usb_service.h

Issue 236203019: Move UsbService to its own component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move usb_service component symbols into usb_service namespace Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « components/usb_service/usb_interface.cc ('k') | components/usb_service/usb_service.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_USB_USB_SERVICE_H_ 5 #ifndef COMPONENTS_USB_SERVICE_USB_SERVICE_H_
6 #define CHROME_BROWSER_USB_USB_SERVICE_H_ 6 #define COMPONENTS_USB_SERVICE_USB_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "base/threading/non_thread_safe.h" 16 #include "base/threading/non_thread_safe.h"
17 #include "components/usb_service/usb_service_export.h"
18
19 struct libusb_device;
20 struct libusb_context;
21
22 namespace usb_service {
17 23
18 typedef struct libusb_device* PlatformUsbDevice; 24 typedef struct libusb_device* PlatformUsbDevice;
19 typedef struct libusb_context* PlatformUsbContext; 25 typedef struct libusb_context* PlatformUsbContext;
20 26
21 class UsbContext; 27 class UsbContext;
22 class UsbDevice; 28 class UsbDevice;
23 29
24 // The USB service handles creating and managing an event handler thread that is 30 // The USB service handles creating and managing an event handler thread that is
25 // used to manage and dispatch USB events. It is also responsible for device 31 // used to manage and dispatch USB events. It is also responsible for device
26 // discovery on the system, which allows it to re-use device handles to prevent 32 // discovery on the system, which allows it to re-use device handles to prevent
27 // competition for the same USB device. 33 // competition for the same USB device.
28 class UsbService : public base::MessageLoop::DestructionObserver, 34 class USB_SERVICE_EXPORT UsbService
29 public base::NonThreadSafe { 35 : public base::MessageLoop::DestructionObserver,
36 public base::NonThreadSafe {
30 public: 37 public:
31 typedef scoped_ptr<std::vector<scoped_refptr<UsbDevice> > > 38 typedef scoped_ptr<std::vector<scoped_refptr<UsbDevice> > >
32 ScopedDeviceVector; 39 ScopedDeviceVector;
33 40
34 // Must be called on FILE thread. 41 // Must be called on FILE thread.
35 // Returns NULL when failed to initialized. 42 // Returns NULL when failed to initialized.
36 static UsbService* GetInstance(); 43 static UsbService* GetInstance();
37 44
38 scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id); 45 scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id);
39 46
(...skipping 19 matching lines...) Expand all
59 // TODO(ikarienator): Figure out a better solution. 66 // TODO(ikarienator): Figure out a better solution.
60 uint32 next_unique_id_; 67 uint32 next_unique_id_;
61 68
62 // The map from PlatformUsbDevices to UsbDevices. 69 // The map from PlatformUsbDevices to UsbDevices.
63 typedef std::map<PlatformUsbDevice, scoped_refptr<UsbDevice> > DeviceMap; 70 typedef std::map<PlatformUsbDevice, scoped_refptr<UsbDevice> > DeviceMap;
64 DeviceMap devices_; 71 DeviceMap devices_;
65 72
66 DISALLOW_COPY_AND_ASSIGN(UsbService); 73 DISALLOW_COPY_AND_ASSIGN(UsbService);
67 }; 74 };
68 75
69 #endif // CHROME_BROWSER_USB_USB_SERVICE_H_ 76 } // namespace usb_service
77
78 #endif // COMPONENTS_USB_SERVICE_USB_SERVICE_H_
OLDNEW
« no previous file with comments | « components/usb_service/usb_interface.cc ('k') | components/usb_service/usb_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698