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 #include "extensions/browser/api/device_permissions_manager.h" | 5 #include "extensions/browser/api/device_permissions_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 // Returns all DevicePermissionEntries for the app. | 245 // Returns all DevicePermissionEntries for the app. |
246 std::set<scoped_refptr<DevicePermissionEntry>> GetDevicePermissionEntries( | 246 std::set<scoped_refptr<DevicePermissionEntry>> GetDevicePermissionEntries( |
247 ExtensionPrefs* prefs, | 247 ExtensionPrefs* prefs, |
248 const std::string& extension_id) { | 248 const std::string& extension_id) { |
249 std::set<scoped_refptr<DevicePermissionEntry>> result; | 249 std::set<scoped_refptr<DevicePermissionEntry>> result; |
250 const base::ListValue* devices = NULL; | 250 const base::ListValue* devices = NULL; |
251 if (!prefs->ReadPrefAsList(extension_id, kDevices, &devices)) { | 251 if (!prefs->ReadPrefAsList(extension_id, kDevices, &devices)) { |
252 return result; | 252 return result; |
253 } | 253 } |
254 | 254 |
255 for (const base::Value* entry : *devices) { | 255 for (const auto& entry : *devices) { |
256 const base::DictionaryValue* entry_dict; | 256 const base::DictionaryValue* entry_dict; |
257 if (entry->GetAsDictionary(&entry_dict)) { | 257 if (entry->GetAsDictionary(&entry_dict)) { |
258 scoped_refptr<DevicePermissionEntry> device_entry = | 258 scoped_refptr<DevicePermissionEntry> device_entry = |
259 ReadDevicePermissionEntry(entry_dict); | 259 ReadDevicePermissionEntry(entry_dict); |
260 if (entry_dict) { | 260 if (entry_dict) { |
261 result.insert(device_entry); | 261 result.insert(device_entry); |
262 } | 262 } |
263 } | 263 } |
264 } | 264 } |
265 return result; | 265 return result; |
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 | 724 |
725 BrowserContext* DevicePermissionsManagerFactory::GetBrowserContextToUse( | 725 BrowserContext* DevicePermissionsManagerFactory::GetBrowserContextToUse( |
726 BrowserContext* context) const { | 726 BrowserContext* context) const { |
727 // Return the original (possibly off-the-record) browser context so that a | 727 // Return the original (possibly off-the-record) browser context so that a |
728 // separate instance of the DevicePermissionsManager is used in incognito | 728 // separate instance of the DevicePermissionsManager is used in incognito |
729 // mode. The parent class's implemenation returns NULL. | 729 // mode. The parent class's implemenation returns NULL. |
730 return context; | 730 return context; |
731 } | 731 } |
732 | 732 |
733 } // namespace extensions | 733 } // namespace extensions |
OLD | NEW |