| 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..bdbe182ada06f671480cd67ed9f8c37219623b2a
|
| --- /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/memory/weak_ptr.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 GotUsbDeviceList(
|
| + const std::vector<scoped_refptr<device::UsbDevice>>& devices);
|
| +
|
| + private:
|
| + std::vector<scoped_refptr<device::UsbDevice>> devices_;
|
| + std::vector<base::string16> devices_names_;
|
| + std::vector<device::UsbDeviceFilter> filters_;
|
| + content::RenderFrameHost* const render_frame_host_;
|
| + webusb::WebUsbPermissionBubble::GetPermissionCallback callback_;
|
| + ScopedObserver<device::UsbService, device::UsbService::Observer>
|
| + usb_service_observer_;
|
| + base::WeakPtrFactory<UsbChooserOptions> weak_factory_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(UsbChooserOptions);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_USB_USB_CHOOSER_OPTIONS_H_
|
|
|