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

Side by Side Diff: extensions/browser/verified_contents.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/verified_contents.h" 5 #include "extensions/browser/verified_contents.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/base64url.h" 9 #include "base/base64url.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 28 matching lines...) Expand all
39 const char kSignedContentKey[] = "signed_content"; 39 const char kSignedContentKey[] = "signed_content";
40 const char kTreeHashPerFile[] = "treehash per file"; 40 const char kTreeHashPerFile[] = "treehash per file";
41 const char kTreeHash[] = "treehash"; 41 const char kTreeHash[] = "treehash";
42 const char kWebstoreKId[] = "webstore"; 42 const char kWebstoreKId[] = "webstore";
43 43
44 // Helper function to iterate over a list of dictionaries, returning the 44 // Helper function to iterate over a list of dictionaries, returning the
45 // dictionary that has |key| -> |value| in it, if any, or NULL. 45 // dictionary that has |key| -> |value| in it, if any, or NULL.
46 DictionaryValue* FindDictionaryWithValue(const ListValue* list, 46 DictionaryValue* FindDictionaryWithValue(const ListValue* list,
47 std::string key, 47 std::string key,
48 std::string value) { 48 std::string value) {
49 for (ListValue::const_iterator i = list->begin(); i != list->end(); ++i) { 49 for (const auto& i : *list) {
50 if (!(*i)->IsType(Value::TYPE_DICTIONARY)) 50 DictionaryValue* dictionary;
51 if (!i->GetAsDictionary(&dictionary))
51 continue; 52 continue;
52 DictionaryValue* dictionary = static_cast<DictionaryValue*>(*i);
53 std::string found_value; 53 std::string found_value;
54 if (dictionary->GetString(key, &found_value) && found_value == value) 54 if (dictionary->GetString(key, &found_value) && found_value == value)
55 return dictionary; 55 return dictionary;
56 } 56 }
57 return NULL; 57 return NULL;
58 } 58 }
59 59
60 } // namespace 60 } // namespace
61 61
62 namespace extensions { 62 namespace extensions {
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 reinterpret_cast<const uint8_t*>(payload.data()), payload.size()); 319 reinterpret_cast<const uint8_t*>(payload.data()), payload.size());
320 320
321 if (!signature_verifier.VerifyFinal()) { 321 if (!signature_verifier.VerifyFinal()) {
322 VLOG(1) << "Could not verify signature - VerifyFinal failure"; 322 VLOG(1) << "Could not verify signature - VerifyFinal failure";
323 return false; 323 return false;
324 } 324 }
325 return true; 325 return true;
326 } 326 }
327 327
328 } // namespace extensions 328 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/system_network/system_network_apitest.cc ('k') | extensions/common/extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698