OLD | NEW |
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_EXTENSIONS_API_USB_USB_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/extensions/api/api_function.h" | 10 #include "chrome/browser/extensions/api/api_function.h" |
11 #include "chrome/browser/extensions/api/api_resource_manager.h" | 11 #include "chrome/browser/extensions/api/api_resource_manager.h" |
12 #include "chrome/common/extensions/api/experimental_usb.h" | 12 #include "chrome/common/extensions/api/experimental_usb.h" |
13 | 13 |
| 14 class UsbDevice; |
| 15 |
14 namespace extensions { | 16 namespace extensions { |
15 | 17 |
16 class ApiResourceEventNotifier; | 18 class ApiResourceEventNotifier; |
17 class UsbDeviceResource; | 19 class UsbDeviceResource; |
18 | 20 |
19 class UsbAsyncApiFunction : public AsyncApiFunction { | 21 class UsbAsyncApiFunction : public AsyncApiFunction { |
20 public: | 22 public: |
21 UsbAsyncApiFunction(); | 23 UsbAsyncApiFunction(); |
22 | 24 |
23 protected: | 25 protected: |
24 virtual ~UsbAsyncApiFunction(); | 26 virtual ~UsbAsyncApiFunction(); |
25 | 27 |
26 virtual bool PrePrepare() OVERRIDE; | 28 virtual bool PrePrepare() OVERRIDE; |
27 | 29 |
28 ApiResourceManager<UsbDeviceResource>* manager_; | 30 ApiResourceManager<UsbDeviceResource>* manager_; |
29 }; | 31 }; |
30 | 32 |
31 class UsbFindDeviceFunction : public UsbAsyncApiFunction { | 33 class UsbFindDeviceFunction : public UsbAsyncApiFunction { |
32 public: | 34 public: |
33 DECLARE_EXTENSION_FUNCTION_NAME("experimental.usb.findDevice"); | 35 DECLARE_EXTENSION_FUNCTION_NAME("experimental.usb.findDevice"); |
34 | 36 |
35 UsbFindDeviceFunction(); | 37 UsbFindDeviceFunction(); |
36 | 38 |
| 39 static void SetDeviceForTest(UsbDevice* device); |
| 40 |
37 protected: | 41 protected: |
38 virtual ~UsbFindDeviceFunction(); | 42 virtual ~UsbFindDeviceFunction(); |
39 virtual bool Prepare() OVERRIDE; | 43 virtual bool Prepare() OVERRIDE; |
40 virtual void Work() OVERRIDE; | 44 virtual void Work() OVERRIDE; |
41 virtual bool Respond() OVERRIDE; | 45 virtual bool Respond() OVERRIDE; |
42 | 46 |
43 private: | 47 private: |
44 scoped_ptr<extensions::api::experimental_usb::FindDevice::Params> parameters_; | 48 scoped_ptr<extensions::api::experimental_usb::FindDevice::Params> parameters_; |
45 ApiResourceEventNotifier* event_notifier_; | 49 ApiResourceEventNotifier* event_notifier_; |
46 }; | 50 }; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 virtual bool Respond() OVERRIDE; | 130 virtual bool Respond() OVERRIDE; |
127 | 131 |
128 private: | 132 private: |
129 scoped_ptr<extensions::api::experimental_usb::IsochronousTransfer::Params> | 133 scoped_ptr<extensions::api::experimental_usb::IsochronousTransfer::Params> |
130 parameters_; | 134 parameters_; |
131 }; | 135 }; |
132 | 136 |
133 } // namespace extensions | 137 } // namespace extensions |
134 | 138 |
135 #endif // CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_ | 139 #endif // CHROME_BROWSER_EXTENSIONS_API_USB_USB_API_H_ |
OLD | NEW |