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

Side by Side Diff: chrome/browser/usb/usb_chooser_options.h

Issue 1408193003: Add chrome side webusb permission UI code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address felt@'s comments Created 5 years 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
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_USB_USB_CHOOSER_OPTIONS_H_
6 #define CHROME_BROWSER_USB_USB_CHOOSER_OPTIONS_H_
7
8 #include "base/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/scoped_observer.h"
12 #include "chrome/browser/ui/website_settings/chooser_options.h"
13 #include "components/webusb/public/interfaces/webusb_permission_bubble.mojom.h"
14 #include "device/usb/usb_service.h"
15 #include "mojo/public/cpp/bindings/array.h"
16 #include "url/gurl.h"
17
18 namespace content {
19 class RenderFrameHost;
20 }
21
22 namespace device {
23 class UsbDevice;
24 class UsbDeviceFilter;
25 }
26
27 class UsbChooserOptions : public ChooserOptions,
28 public device::UsbService::Observer {
29 public:
30 UsbChooserOptions(
31 mojo::Array<device::usb::DeviceFilterPtr> device_filters,
32 content::RenderFrameHost* render_frame_host,
33 const webusb::WebUsbPermissionBubble::GetPermissionCallback& callback);
34 ~UsbChooserOptions() override;
35
36 // ChooserOptions:
37 const std::vector<base::string16>& GetOptions() const override;
38 void Select(int index) override;
39
40 // device::UsbService::Observer:
41 void OnDeviceAdded(scoped_refptr<device::UsbDevice> device) override;
42 void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override;
43
44 void GotUsbDeviceList(
45 const std::vector<scoped_refptr<device::UsbDevice>>& devices);
46
47 private:
48 std::vector<scoped_refptr<device::UsbDevice>> devices_;
49 std::vector<base::string16> devices_names_;
50 std::vector<device::UsbDeviceFilter> filters_;
51 content::RenderFrameHost* const render_frame_host_;
52 webusb::WebUsbPermissionBubble::GetPermissionCallback callback_;
53 ScopedObserver<device::UsbService, device::UsbService::Observer>
54 usb_service_observer_;
55 base::WeakPtrFactory<UsbChooserOptions> weak_factory_;
56
57 DISALLOW_COPY_AND_ASSIGN(UsbChooserOptions);
58 };
59
60 #endif // CHROME_BROWSER_USB_USB_CHOOSER_OPTIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698