Chromium Code Reviews| Index: chrome/browser/usb/usb_chooser_options.h |
| diff --git a/chrome/browser/usb/usb_chooser_options.h b/chrome/browser/usb/usb_chooser_options.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8e56073f499f8a6e8b9578561e0192d0dd7bae47 |
| --- /dev/null |
| +++ b/chrome/browser/usb/usb_chooser_options.h |
| @@ -0,0 +1,60 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_USB_USB_CHOOSER_OPTIONS_H_ |
| +#define CHROME_BROWSER_USB_USB_CHOOSER_OPTIONS_H_ |
| + |
| +#include "base/macros.h" |
| +#include "base/memory/ref_counted.h" |
| +#include "base/scoped_observer.h" |
| +#include "chrome/browser/ui/website_settings/chooser_options.h" |
| +#include "components/webusb/public/interfaces/webusb_permission_bubble.mojom.h" |
| +#include "device/usb/usb_service.h" |
| +#include "mojo/public/cpp/bindings/array.h" |
| +#include "url/gurl.h" |
| + |
| +namespace content { |
| +class RenderFrameHost; |
| +} |
| + |
| +namespace device { |
| +class UsbDevice; |
| +class UsbDeviceFilter; |
| +} |
| + |
| +class UsbChooserOptions : public ChooserOptions, |
| + public device::UsbService::Observer { |
| + public: |
| + UsbChooserOptions( |
| + mojo::Array<device::usb::DeviceFilterPtr> device_filters, |
| + content::RenderFrameHost* render_frame_host, |
| + const webusb::WebUsbPermissionBubble::GetPermissionCallback& callback); |
| + ~UsbChooserOptions() override; |
| + |
| + // ChooserOptions: |
| + const std::vector<base::string16>& GetOptions() const override; |
| + void Select(int index) override; |
| + |
| + // device::UsbService::Observer: |
| + void OnDeviceAdded(scoped_refptr<device::UsbDevice> device) override; |
| + void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; |
| + |
| + void GetUsbDevicesList( |
|
Reilly Grant (use Gerrit)
2015/11/16 22:45:46
s/GetUsbDevicesList/GotUsbDeviceList/
juncai
2015/11/17 03:42:15
Done.
|
| + const std::vector<scoped_refptr<device::UsbDevice>>& devices); |
| + |
| + private: |
| + std::vector<scoped_refptr<device::UsbDevice>> devices_; |
| + std::vector<base::string16> devices_names_; |
| + mojo::Array<device::usb::DeviceFilterPtr> device_filters_; |
| + std::vector<device::UsbDeviceFilter> filters_; |
| + GURL origin_; |
| + content::RenderFrameHost* const render_frame_host_; |
| + webusb::WebUsbPermissionBubble::GetPermissionCallback callback_; |
| + ScopedObserver<device::UsbService, device::UsbService::Observer> |
| + usb_service_observer_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(UsbChooserOptions); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_USB_USB_CHOOSER_OPTIONS_H_ |