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

Side by Side Diff: chrome/browser/chromeos/platform_keys/key_permissions.cc

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: MakeUnique Created 4 years, 2 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 new_entry->SetStringWithoutPathExpansion(kStateStoreSPKI, entry.spki_b64); 288 new_entry->SetStringWithoutPathExpansion(kStateStoreSPKI, entry.spki_b64);
289 // Omit writing default values, namely |false|. 289 // Omit writing default values, namely |false|.
290 if (entry.sign_once) { 290 if (entry.sign_once) {
291 new_entry->SetBooleanWithoutPathExpansion(kStateStoreSignOnce, 291 new_entry->SetBooleanWithoutPathExpansion(kStateStoreSignOnce,
292 entry.sign_once); 292 entry.sign_once);
293 } 293 }
294 if (entry.sign_unlimited) { 294 if (entry.sign_unlimited) {
295 new_entry->SetBooleanWithoutPathExpansion(kStateStoreSignUnlimited, 295 new_entry->SetBooleanWithoutPathExpansion(kStateStoreSignUnlimited,
296 entry.sign_unlimited); 296 entry.sign_unlimited);
297 } 297 }
298 new_state->Append(new_entry.release()); 298 new_state->Append(std::move(new_entry));
299 } 299 }
300 return std::move(new_state); 300 return std::move(new_state);
301 } 301 }
302 302
303 KeyPermissions::PermissionsForExtension::KeyEntry* 303 KeyPermissions::PermissionsForExtension::KeyEntry*
304 KeyPermissions::PermissionsForExtension::GetStateStoreEntry( 304 KeyPermissions::PermissionsForExtension::GetStateStoreEntry(
305 const std::string& public_key_spki_der_b64) { 305 const std::string& public_key_spki_der_b64) {
306 for (KeyEntry& entry : state_store_entries_) { 306 for (KeyEntry& entry : state_store_entries_) {
307 // For every ASN.1 value there is exactly one DER encoding, so it is fine to 307 // For every ASN.1 value there is exactly one DER encoding, so it is fine to
308 // compare the DER (or its base64 encoding). 308 // compare the DER (or its base64 encoding).
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 const base::DictionaryValue* platform_keys = 393 const base::DictionaryValue* platform_keys =
394 profile_prefs_->GetDictionary(prefs::kPlatformKeys); 394 profile_prefs_->GetDictionary(prefs::kPlatformKeys);
395 395
396 const base::DictionaryValue* key_entry = nullptr; 396 const base::DictionaryValue* key_entry = nullptr;
397 platform_keys->GetDictionaryWithoutPathExpansion(public_key_spki_der_b64, 397 platform_keys->GetDictionaryWithoutPathExpansion(public_key_spki_der_b64,
398 &key_entry); 398 &key_entry);
399 return key_entry; 399 return key_entry;
400 } 400 }
401 401
402 } // namespace chromeos 402 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698