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

Side by Side Diff: chrome/browser/extensions/api/hid/hid_device_manager.h

Issue 161823002: Clean up HID backend and API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_HID_HID_DEVICE_MANAGER_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_HID_HID_DEVICE_MANAGER_H_
7
8 #include <stdint.h>
9
10 #include <map>
11 #include <vector>
Mark Mentovai 2014/02/24 20:23:36 Unused in the .h. Move to the .cc.
Ken Rockot(use gerrit already) 2014/02/25 21:30:01 Done.
12
13 #include "base/basictypes.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/threading/thread_checker.h"
16 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/extensions/api/hid.h"
19 #include "device/hid/hid_device_info.h"
20
21 namespace extensions {
22
23 class HidDeviceManager : public ProfileKeyedAPI {
24 public:
25 explicit HidDeviceManager(Profile* profile);
26 virtual ~HidDeviceManager();
27
28 // ProfileKeyedAPI implementation.
29 static ProfileKeyedAPIFactory<HidDeviceManager>* GetFactoryInstance();
30
31 // Convenience method to get the HidDeviceManager for a profile.
32 static HidDeviceManager* Get(Profile* profile) {
33 return ProfileKeyedAPIFactory<HidDeviceManager>::GetForProfile(profile);
34 }
35
36 scoped_ptr<base::ListValue> GetApiDevices(uint16_t vendor_id,
37 uint16_t product_id);
38
39 bool GetDeviceInfo(int resource_id, device::HidDeviceInfo* device_info);
40
41 private:
42 friend class ProfileKeyedAPIFactory<HidDeviceManager>;
43
44 static const char* service_name() { return "HidDeviceManager"; }
45
46 void UpdateDevices();
47
48 base::ThreadChecker thread_checker_;
49
50 int next_resource_id_;
51
52 typedef std::map<int, device::HidDeviceId> ResourceIdToDeviceIdMap;
53 typedef std::map<device::HidDeviceId, int> DeviceIdToResourceIdMap;
54
55 ResourceIdToDeviceIdMap device_ids_;
56 DeviceIdToResourceIdMap resource_ids_;
57
58 DISALLOW_COPY_AND_ASSIGN(HidDeviceManager);
59 };
60
61 } // namespace extensions
62
63 #endif // CHROME_BROWSER_EXTENSIONS_API_HID_HID_DEVICE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698