OLD | NEW |
(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 COMPONENTS_WEBUSB_WEBUSB_DETECTOR_H_ |
| 6 #define COMPONENTS_WEBUSB_WEBUSB_DETECTOR_H_ |
| 7 |
| 8 #include "base/scoped_observer.h" |
| 9 #include "components/keyed_service/core/keyed_service.h" |
| 10 #include "device/usb/usb_service.h" |
| 11 |
| 12 class Profile; |
| 13 |
| 14 namespace webusb { |
| 15 |
| 16 class UsbDevice; |
| 17 |
| 18 class WebUsbDetector : public KeyedService, |
| 19 public device::UsbService::Observer { |
| 20 public: |
| 21 WebUsbDetector(Profile* profile); |
| 22 |
| 23 ~WebUsbDetector() override; |
| 24 |
| 25 private: |
| 26 // KeyedService override: |
| 27 void Shutdown() override; |
| 28 |
| 29 // UsbService::observer override: |
| 30 void OnDeviceAdded(scoped_refptr<device::UsbDevice> device) override; |
| 31 |
| 32 // UsbService::observer override: |
| 33 void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override; |
| 34 |
| 35 // Initializes the webusb detector. |
| 36 void Initialize(); |
| 37 |
| 38 Profile* profile_; |
| 39 ScopedObserver<device::UsbService, device::UsbService::Observer> observer_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(WebUsbDetector); |
| 42 }; |
| 43 |
| 44 } // namespace webusb |
| 45 |
| 46 #endif // COMPONENTS_WEBUSB_WEBUSB_DETECTOR_H_ |
OLD | NEW |