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

Side by Side Diff: device/usb/usb_service.h

Issue 891853002: Add a UsbService::Observer function for cleanup actions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months 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
« no previous file with comments | « no previous file | device/usb/usb_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DEVICE_USB_USB_SERVICE_H_ 5 #ifndef DEVICE_USB_USB_SERVICE_H_
6 #define DEVICE_USB_USB_SERVICE_H_ 6 #define DEVICE_USB_USB_SERVICE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 17 matching lines...) Expand all
28 // All functions on this object must be called from a thread with a 28 // All functions on this object must be called from a thread with a
29 // MessageLoopForIO (for example, BrowserThread::FILE). 29 // MessageLoopForIO (for example, BrowserThread::FILE).
30 class UsbService : public base::NonThreadSafe { 30 class UsbService : public base::NonThreadSafe {
31 public: 31 public:
32 class Observer { 32 class Observer {
33 public: 33 public:
34 // These events are delivered from the thread on which the UsbService object 34 // These events are delivered from the thread on which the UsbService object
35 // was created. 35 // was created.
36 virtual void OnDeviceAdded(scoped_refptr<UsbDevice> device); 36 virtual void OnDeviceAdded(scoped_refptr<UsbDevice> device);
37 virtual void OnDeviceRemoved(scoped_refptr<UsbDevice> device); 37 virtual void OnDeviceRemoved(scoped_refptr<UsbDevice> device);
38 // For observers that need to process device removal after others have run.
39 // Should not depend on any other service's knowledge of connected devices.
40 virtual void OnDeviceRemovedCleanup(scoped_refptr<UsbDevice> device);
38 }; 41 };
39 42
40 // The UI task runner reference is used to talk to the PermissionBrokerClient 43 // The UI task runner reference is used to talk to the PermissionBrokerClient
41 // on ChromeOS (UI thread). Returns NULL when initialization fails. 44 // on ChromeOS (UI thread). Returns NULL when initialization fails.
42 static UsbService* GetInstance( 45 static UsbService* GetInstance(
43 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); 46 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner);
44 47
45 static void SetInstanceForTest(UsbService* instance); 48 static void SetInstanceForTest(UsbService* instance);
46 49
47 virtual scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id) = 0; 50 virtual scoped_refptr<UsbDevice> GetDeviceById(uint32 unique_id) = 0;
(...skipping 17 matching lines...) Expand all
65 68
66 private: 69 private:
67 class Destroyer; 70 class Destroyer;
68 71
69 DISALLOW_COPY_AND_ASSIGN(UsbService); 72 DISALLOW_COPY_AND_ASSIGN(UsbService);
70 }; 73 };
71 74
72 } // namespace device 75 } // namespace device
73 76
74 #endif // DEVICE_USB_USB_SERVICE_H_ 77 #endif // DEVICE_USB_USB_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | device/usb/usb_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698