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.
5 #ifndef COMPONENTS_WEBUSB_WEBUSB_DETECTOR_H_
6 #define COMPONENTS_WEBUSB_WEBUSB_DETECTOR_H_
8 #include "base/scoped_observer.h"
9 #include "device/usb/usb_service.h"
18 class WebUsbBrowserClient
;
20 class WebUsbDetector
: public device::UsbService::Observer
{
22 explicit WebUsbDetector(WebUsbBrowserClient
* webusb_browser_client
);
24 ~WebUsbDetector() override
;
27 // Initializes the WebUsbDetector.
30 // UsbService::observer override:
31 void OnDeviceAdded(scoped_refptr
<device::UsbDevice
> device
) override
;
33 // UsbService::observer override:
34 void OnDeviceRemoved(scoped_refptr
<device::UsbDevice
> device
) override
;
36 WebUsbBrowserClient
* webusb_browser_client_
= nullptr;
38 ScopedObserver
<device::UsbService
, device::UsbService::Observer
> observer_
;
40 DISALLOW_COPY_AND_ASSIGN(WebUsbDetector
);
45 #endif // COMPONENTS_WEBUSB_WEBUSB_DETECTOR_H_