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

Side by Side Diff: chrome/browser/chromeos/platform_keys/key_permissions.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "chrome/browser/chromeos/platform_keys/key_permissions.h" 5 #include "chrome/browser/chromeos/platform_keys/key_permissions.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 239
240 void KeyPermissions::PermissionsForExtension::KeyEntriesFromState( 240 void KeyPermissions::PermissionsForExtension::KeyEntriesFromState(
241 const base::Value& state) { 241 const base::Value& state) {
242 state_store_entries_.clear(); 242 state_store_entries_.clear();
243 243
244 const base::ListValue* entries = nullptr; 244 const base::ListValue* entries = nullptr;
245 if (!state.GetAsList(&entries)) { 245 if (!state.GetAsList(&entries)) {
246 LOG(ERROR) << "Found a state store of wrong type."; 246 LOG(ERROR) << "Found a state store of wrong type.";
247 return; 247 return;
248 } 248 }
249 for (const base::Value* entry : *entries) { 249 for (const auto& entry : *entries) {
250 if (!entry) { 250 if (!entry) {
251 LOG(ERROR) << "Found invalid NULL entry in PlatformKeys state store."; 251 LOG(ERROR) << "Found invalid NULL entry in PlatformKeys state store.";
252 continue; 252 continue;
253 } 253 }
254 254
255 std::string spki_b64; 255 std::string spki_b64;
256 const base::DictionaryValue* dict_entry = nullptr; 256 const base::DictionaryValue* dict_entry = nullptr;
257 if (entry->GetAsString(&spki_b64)) { 257 if (entry->GetAsString(&spki_b64)) {
258 // This handles the case that the store contained a plain list of base64 258 // This handles the case that the store contained a plain list of base64
259 // and DER-encoded SPKIs from an older version of ChromeOS. 259 // and DER-encoded SPKIs from an older version of ChromeOS.
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 const base::DictionaryValue* platform_keys = 394 const base::DictionaryValue* platform_keys =
395 profile_prefs_->GetDictionary(prefs::kPlatformKeys); 395 profile_prefs_->GetDictionary(prefs::kPlatformKeys);
396 396
397 const base::DictionaryValue* key_entry = nullptr; 397 const base::DictionaryValue* key_entry = nullptr;
398 platform_keys->GetDictionaryWithoutPathExpansion(public_key_spki_der_b64, 398 platform_keys->GetDictionaryWithoutPathExpansion(public_key_spki_der_b64,
399 &key_entry); 399 &key_entry);
400 return key_entry; 400 return key_entry;
401 } 401 }
402 402
403 } // namespace chromeos 403 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ui/webui_login_view.cc ('k') | chrome/browser/devtools/devtools_embedder_message_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698