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

Side by Side Diff: extensions/browser/api/device_permissions_manager.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 4 years, 7 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 #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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698