OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |