OLD | NEW |
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_DEVICE_PERMISSION_MANAGER_H_ | 5 #ifndef EXTENSIONS_DEVICE_PERMISSION_MANAGER_H_ |
6 #define EXTENSIONS_DEVICE_PERMISSION_MANAGER_H_ | 6 #define EXTENSIONS_DEVICE_PERMISSION_MANAGER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <set> | 11 #include <set> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
13 #include "base/macros.h" | 15 #include "base/macros.h" |
14 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
16 #include "base/scoped_observer.h" | 18 #include "base/scoped_observer.h" |
17 #include "base/strings/string16.h" | 19 #include "base/strings/string16.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 }; | 136 }; |
135 | 137 |
136 // Manages saved device permissions for all extensions. | 138 // Manages saved device permissions for all extensions. |
137 class DevicePermissionsManager : public KeyedService, | 139 class DevicePermissionsManager : public KeyedService, |
138 public device::UsbService::Observer, | 140 public device::UsbService::Observer, |
139 public device::HidService::Observer { | 141 public device::HidService::Observer { |
140 public: | 142 public: |
141 static DevicePermissionsManager* Get(content::BrowserContext* context); | 143 static DevicePermissionsManager* Get(content::BrowserContext* context); |
142 | 144 |
143 static base::string16 GetPermissionMessage( | 145 static base::string16 GetPermissionMessage( |
144 uint16 vendor_id, | 146 uint16_t vendor_id, |
145 uint16 product_id, | 147 uint16_t product_id, |
146 const base::string16& manufacturer_string, | 148 const base::string16& manufacturer_string, |
147 const base::string16& product_string, | 149 const base::string16& product_string, |
148 const base::string16& serial_number, | 150 const base::string16& serial_number, |
149 bool always_include_manufacturer); | 151 bool always_include_manufacturer); |
150 | 152 |
151 // The DevicePermissions object for a given extension. | 153 // The DevicePermissions object for a given extension. |
152 DevicePermissions* GetForExtension(const std::string& extension_id); | 154 DevicePermissions* GetForExtension(const std::string& extension_id); |
153 | 155 |
154 // Equivalent to calling GetForExtension and extracting the permission string | 156 // Equivalent to calling GetForExtension and extracting the permission string |
155 // for each entry. | 157 // for each entry. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 content::BrowserContext* context) const override; | 221 content::BrowserContext* context) const override; |
220 content::BrowserContext* GetBrowserContextToUse( | 222 content::BrowserContext* GetBrowserContextToUse( |
221 content::BrowserContext* context) const override; | 223 content::BrowserContext* context) const override; |
222 | 224 |
223 DISALLOW_COPY_AND_ASSIGN(DevicePermissionsManagerFactory); | 225 DISALLOW_COPY_AND_ASSIGN(DevicePermissionsManagerFactory); |
224 }; | 226 }; |
225 | 227 |
226 } // namespace extensions | 228 } // namespace extensions |
227 | 229 |
228 #endif // EXTENSIONS_DEVICE_PERMISSION_MANAGER_H_ | 230 #endif // EXTENSIONS_DEVICE_PERMISSION_MANAGER_H_ |
OLD | NEW |