Refactor WebsiteSettings to operate on a SecurityInfo
[chromium-blink-merge.git] / device / usb / usb_service.cc
blobde9716f1d19b90c271894cb3baa1875a75a5907d
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 #include "device/usb/usb_service.h"
7 #include "base/at_exit.h"
8 #include "base/bind.h"
9 #include "components/device_event_log/device_event_log.h"
10 #include "device/usb/usb_device.h"
11 #include "device/usb/usb_service_impl.h"
13 namespace device {
15 UsbService::Observer::~Observer() {}
17 void UsbService::Observer::OnDeviceAdded(scoped_refptr<UsbDevice> device) {
20 void UsbService::Observer::OnDeviceRemoved(scoped_refptr<UsbDevice> device) {
23 void UsbService::Observer::OnDeviceRemovedCleanup(
24 scoped_refptr<UsbDevice> device) {
27 void UsbService::Observer::WillDestroyUsbService() {}
29 // static
30 scoped_ptr<UsbService> UsbService::Create(
31 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner) {
32 return make_scoped_ptr(new UsbServiceImpl(blocking_task_runner));
35 UsbService::~UsbService() {
36 FOR_EACH_OBSERVER(Observer, observer_list_, WillDestroyUsbService());
39 UsbService::UsbService() {}
41 void UsbService::AddObserver(Observer* observer) {
42 DCHECK(CalledOnValidThread());
43 observer_list_.AddObserver(observer);
46 void UsbService::RemoveObserver(Observer* observer) {
47 DCHECK(CalledOnValidThread());
48 observer_list_.RemoveObserver(observer);
51 void UsbService::NotifyDeviceAdded(scoped_refptr<UsbDevice> device) {
52 DCHECK(CalledOnValidThread());
54 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceAdded(device));
57 void UsbService::NotifyDeviceRemoved(scoped_refptr<UsbDevice> device) {
58 DCHECK(CalledOnValidThread());
60 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceRemoved(device));
61 FOR_EACH_OBSERVER(Observer, observer_list_, OnDeviceRemovedCleanup(device));
64 } // namespace device