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

Side by Side Diff: device/hid/hid_service.h

Issue 1874313002: Convert device to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 | « device/hid/hid_connection_unittest.cc ('k') | device/hid/hid_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_HID_HID_SERVICE_H_ 5 #ifndef DEVICE_HID_HID_SERVICE_H_
6 #define DEVICE_HID_HID_SERVICE_H_ 6 #define DEVICE_HID_HID_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory>
9 #include <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
19 #include "device/hid/hid_device_info.h" 19 #include "device/hid/hid_device_info.h"
20 20
21 namespace device { 21 namespace device {
22 22
23 class HidConnection; 23 class HidConnection;
24 24
25 // The HidService keeps track of human interface devices connected to the 25 // The HidService keeps track of human interface devices connected to the
(...skipping 14 matching lines...) Expand all
40 virtual void OnDeviceRemovedCleanup(scoped_refptr<HidDeviceInfo> info); 40 virtual void OnDeviceRemovedCleanup(scoped_refptr<HidDeviceInfo> info);
41 }; 41 };
42 42
43 typedef base::Callback<void(const std::vector<scoped_refptr<HidDeviceInfo>>&)> 43 typedef base::Callback<void(const std::vector<scoped_refptr<HidDeviceInfo>>&)>
44 GetDevicesCallback; 44 GetDevicesCallback;
45 typedef base::Callback<void(scoped_refptr<HidConnection> connection)> 45 typedef base::Callback<void(scoped_refptr<HidConnection> connection)>
46 ConnectCallback; 46 ConnectCallback;
47 47
48 // This function should be called on a thread with a MessageLoopForUI and be 48 // This function should be called on a thread with a MessageLoopForUI and be
49 // passed the task runner for a thread with a MessageLoopForIO. 49 // passed the task runner for a thread with a MessageLoopForIO.
50 static scoped_ptr<HidService> Create( 50 static std::unique_ptr<HidService> Create(
51 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner); 51 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner);
52 52
53 virtual ~HidService(); 53 virtual ~HidService();
54 54
55 // Enumerates available devices. The provided callback will always be posted 55 // Enumerates available devices. The provided callback will always be posted
56 // to the calling thread's task runner. 56 // to the calling thread's task runner.
57 virtual void GetDevices(const GetDevicesCallback& callback); 57 virtual void GetDevices(const GetDevicesCallback& callback);
58 58
59 void AddObserver(Observer* observer); 59 void AddObserver(Observer* observer);
60 void RemoveObserver(Observer* observer); 60 void RemoveObserver(Observer* observer);
(...skipping 28 matching lines...) Expand all
89 bool enumeration_ready_; 89 bool enumeration_ready_;
90 std::vector<GetDevicesCallback> pending_enumerations_; 90 std::vector<GetDevicesCallback> pending_enumerations_;
91 base::ObserverList<Observer, true> observer_list_; 91 base::ObserverList<Observer, true> observer_list_;
92 92
93 DISALLOW_COPY_AND_ASSIGN(HidService); 93 DISALLOW_COPY_AND_ASSIGN(HidService);
94 }; 94 };
95 95
96 } // namespace device 96 } // namespace device
97 97
98 #endif // DEVICE_HID_HID_SERVICE_H_ 98 #endif // DEVICE_HID_HID_SERVICE_H_
OLDNEW
« no previous file with comments | « device/hid/hid_connection_unittest.cc ('k') | device/hid/hid_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698