| 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 #ifndef EXTENSIONS_BROWSER_API_USB_USB_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_USB_USB_API_H_ |
| 6 #define EXTENSIONS_BROWSER_API_USB_USB_API_H_ | 6 #define EXTENSIONS_BROWSER_API_USB_USB_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "components/usb_service/usb_device.h" | 13 #include "components/usb_service/usb_device.h" |
| 14 #include "components/usb_service/usb_device_filter.h" |
| 14 #include "components/usb_service/usb_device_handle.h" | 15 #include "components/usb_service/usb_device_handle.h" |
| 15 #include "extensions/browser/api/api_resource_manager.h" | 16 #include "extensions/browser/api/api_resource_manager.h" |
| 16 #include "extensions/browser/api/async_api_function.h" | 17 #include "extensions/browser/api/async_api_function.h" |
| 17 #include "extensions/common/api/usb.h" | 18 #include "extensions/common/api/usb.h" |
| 18 #include "net/base/io_buffer.h" | 19 #include "net/base/io_buffer.h" |
| 19 | 20 |
| 20 namespace extensions { | 21 namespace extensions { |
| 21 | 22 |
| 22 class UsbDeviceResource; | 23 class UsbDeviceResource; |
| 23 | 24 |
| 24 class UsbAsyncApiFunction : public AsyncApiFunction { | 25 class UsbAsyncApiFunction : public AsyncApiFunction { |
| 25 public: | 26 public: |
| 26 UsbAsyncApiFunction(); | 27 UsbAsyncApiFunction(); |
| 27 | 28 |
| 28 protected: | 29 protected: |
| 29 virtual ~UsbAsyncApiFunction(); | 30 virtual ~UsbAsyncApiFunction(); |
| 30 | 31 |
| 31 virtual bool PrePrepare() OVERRIDE; | 32 virtual bool PrePrepare() OVERRIDE; |
| 32 virtual bool Respond() OVERRIDE; | 33 virtual bool Respond() OVERRIDE; |
| 33 | 34 |
| 34 scoped_refptr<usb_service::UsbDevice> GetDeviceOrOrCompleteWithError( | 35 static void CreateDeviceFilter( |
| 36 const extensions::core_api::usb::DeviceFilter& input, |
| 37 usb_service::UsbDeviceFilter* output); |
| 38 |
| 39 bool HasDevicePermission(scoped_refptr<usb_service::UsbDevice> device); |
| 40 |
| 41 scoped_refptr<usb_service::UsbDevice> GetDeviceOrCompleteWithError( |
| 35 const extensions::core_api::usb::Device& input_device); | 42 const extensions::core_api::usb::Device& input_device); |
| 36 | 43 |
| 37 scoped_refptr<usb_service::UsbDeviceHandle> | 44 scoped_refptr<usb_service::UsbDeviceHandle> |
| 38 GetDeviceHandleOrCompleteWithError( | 45 GetDeviceHandleOrCompleteWithError( |
| 39 const extensions::core_api::usb::ConnectionHandle& | 46 const extensions::core_api::usb::ConnectionHandle& |
| 40 input_device_handle); | 47 input_device_handle); |
| 41 | 48 |
| 42 void RemoveUsbDeviceResource(int api_resource_id); | 49 void RemoveUsbDeviceResource(int api_resource_id); |
| 43 | 50 |
| 44 void CompleteWithError(const std::string& error); | 51 void CompleteWithError(const std::string& error); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 315 |
| 309 virtual bool Prepare() OVERRIDE; | 316 virtual bool Prepare() OVERRIDE; |
| 310 virtual void AsyncWorkStart() OVERRIDE; | 317 virtual void AsyncWorkStart() OVERRIDE; |
| 311 | 318 |
| 312 private: | 319 private: |
| 313 scoped_ptr<extensions::core_api::usb::ResetDevice::Params> parameters_; | 320 scoped_ptr<extensions::core_api::usb::ResetDevice::Params> parameters_; |
| 314 }; | 321 }; |
| 315 } // namespace extensions | 322 } // namespace extensions |
| 316 | 323 |
| 317 #endif // EXTENSIONS_BROWSER_API_USB_USB_API_H_ | 324 #endif // EXTENSIONS_BROWSER_API_USB_USB_API_H_ |
| OLD | NEW |