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

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

Issue 1236493004: Final batch adding real histogram values for extension events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: android compile Created 5 years, 5 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
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 EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_ 5 #ifndef EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_
6 #define EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_ 6 #define EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "base/scoped_observer.h" 14 #include "base/scoped_observer.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "device/hid/hid_service.h" 16 #include "device/hid/hid_service.h"
17 #include "extensions/browser/browser_context_keyed_api_factory.h" 17 #include "extensions/browser/browser_context_keyed_api_factory.h"
18 #include "extensions/browser/event_router.h" 18 #include "extensions/browser/event_router.h"
19 #include "extensions/browser/extension_event_histogram_value.h"
19 #include "extensions/common/api/hid.h" 20 #include "extensions/common/api/hid.h"
20 21
21 namespace device { 22 namespace device {
22 class HidDeviceFilter; 23 class HidDeviceFilter;
23 class HidDeviceInfo; 24 class HidDeviceInfo;
24 } 25 }
25 26
26 namespace extensions { 27 namespace extensions {
27 28
28 class Extension; 29 class Extension;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 100
100 // Builds a list of device info objects representing the currently enumerated 101 // Builds a list of device info objects representing the currently enumerated
101 // devices, taking into account the permissions held by the given extension 102 // devices, taking into account the permissions held by the given extension
102 // and the filters provided. 103 // and the filters provided.
103 scoped_ptr<base::ListValue> CreateApiDeviceList( 104 scoped_ptr<base::ListValue> CreateApiDeviceList(
104 const Extension* extension, 105 const Extension* extension,
105 const std::vector<device::HidDeviceFilter>& filters); 106 const std::vector<device::HidDeviceFilter>& filters);
106 void OnEnumerationComplete( 107 void OnEnumerationComplete(
107 const std::vector<scoped_refptr<device::HidDeviceInfo>>& devices); 108 const std::vector<scoped_refptr<device::HidDeviceInfo>>& devices);
108 109
109 void DispatchEvent(const std::string& event_name, 110 void DispatchEvent(events::HistogramValue histogram_value,
111 const std::string& event_name,
110 scoped_ptr<base::ListValue> event_args, 112 scoped_ptr<base::ListValue> event_args,
111 scoped_refptr<device::HidDeviceInfo> device_info); 113 scoped_refptr<device::HidDeviceInfo> device_info);
112 114
113 base::ThreadChecker thread_checker_; 115 base::ThreadChecker thread_checker_;
114 content::BrowserContext* browser_context_ = nullptr; 116 content::BrowserContext* browser_context_ = nullptr;
115 EventRouter* event_router_ = nullptr; 117 EventRouter* event_router_ = nullptr;
116 bool initialized_ = false; 118 bool initialized_ = false;
117 ScopedObserver<device::HidService, device::HidService::Observer> 119 ScopedObserver<device::HidService, device::HidService::Observer>
118 hid_service_observer_; 120 hid_service_observer_;
119 bool enumeration_ready_ = false; 121 bool enumeration_ready_ = false;
120 ScopedVector<GetApiDevicesParams> pending_enumerations_; 122 ScopedVector<GetApiDevicesParams> pending_enumerations_;
121 int next_resource_id_ = 0; 123 int next_resource_id_ = 0;
122 ResourceIdToDeviceIdMap device_ids_; 124 ResourceIdToDeviceIdMap device_ids_;
123 DeviceIdToResourceIdMap resource_ids_; 125 DeviceIdToResourceIdMap resource_ids_;
124 base::WeakPtrFactory<HidDeviceManager> weak_factory_; 126 base::WeakPtrFactory<HidDeviceManager> weak_factory_;
125 127
126 DISALLOW_COPY_AND_ASSIGN(HidDeviceManager); 128 DISALLOW_COPY_AND_ASSIGN(HidDeviceManager);
127 }; 129 };
128 130
129 } // namespace extensions 131 } // namespace extensions
130 132
131 #endif // EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_ 133 #endif // EXTENSIONS_BROWSER_API_HID_HID_DEVICE_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/profiles/off_the_record_profile_impl.cc ('k') | extensions/browser/api/hid/hid_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698