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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_site_list.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 "chrome/browser/supervised_user/supervised_user_site_list.h" 5 #include "chrome/browser/supervised_user/supervised_user_site_list.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
(...skipping 27 matching lines...) Expand all
38 if (!value) { 38 if (!value) {
39 LOG(ERROR) << "Couldn't load site list " << path.value() << ": " 39 LOG(ERROR) << "Couldn't load site list " << path.value() << ": "
40 << error_msg; 40 << error_msg;
41 } 41 }
42 return value; 42 return value;
43 } 43 }
44 44
45 std::vector<std::string> ConvertListValues(const base::ListValue* list_values) { 45 std::vector<std::string> ConvertListValues(const base::ListValue* list_values) {
46 std::vector<std::string> converted; 46 std::vector<std::string> converted;
47 if (list_values) { 47 if (list_values) {
48 for (const base::Value* entry : *list_values) { 48 for (const auto& entry : *list_values) {
49 std::string entry_string; 49 std::string entry_string;
50 if (!entry->GetAsString(&entry_string)) { 50 if (!entry->GetAsString(&entry_string)) {
51 LOG(ERROR) << "Invalid whitelist entry"; 51 LOG(ERROR) << "Invalid whitelist entry";
52 continue; 52 continue;
53 } 53 }
54 54
55 converted.push_back(entry_string); 55 converted.push_back(entry_string);
56 } 56 }
57 } 57 }
58 return converted; 58 return converted;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 base::ListValue* patterns = nullptr; 190 base::ListValue* patterns = nullptr;
191 dict->GetList(kWhitelistKey, &patterns); 191 dict->GetList(kWhitelistKey, &patterns);
192 192
193 base::ListValue* hostname_hashes = nullptr; 193 base::ListValue* hostname_hashes = nullptr;
194 dict->GetList(kHostnameHashesKey, &hostname_hashes); 194 dict->GetList(kHostnameHashesKey, &hostname_hashes);
195 195
196 callback.Run(make_scoped_refptr( 196 callback.Run(make_scoped_refptr(
197 new SupervisedUserSiteList(id, title, GURL(entry_point_url), 197 new SupervisedUserSiteList(id, title, GURL(entry_point_url),
198 large_icon_path, patterns, hostname_hashes))); 198 large_icon_path, patterns, hostname_hashes)));
199 } 199 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698