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

Side by Side Diff: chrome/browser/extensions/extension_management_internal.cc

Issue 2833843004: Reland: Communicate ExtensionSettings policy to renderers (Closed)
Patch Set: Removed unused URLPatternSet parameters in ExtensionMsg_PermissionSetStruct which was causing MSAN … Created 3 years, 8 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/extensions/extension_management_internal.h" 5 #include "chrome/browser/extensions/extension_management_internal.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 &blocked_permissions); 108 &blocked_permissions);
109 109
110 // Parses list of Match Patterns into a URLPatternSet. 110 // Parses list of Match Patterns into a URLPatternSet.
111 auto parse_url_pattern_set = [](const base::DictionaryValue* dict, 111 auto parse_url_pattern_set = [](const base::DictionaryValue* dict,
112 const char key[], URLPatternSet* out_value) { 112 const char key[], URLPatternSet* out_value) {
113 const base::ListValue* host_list_value = nullptr; 113 const base::ListValue* host_list_value = nullptr;
114 114
115 // Get the list of URLPatterns. 115 // Get the list of URLPatterns.
116 if (dict->GetListWithoutPathExpansion(key, 116 if (dict->GetListWithoutPathExpansion(key,
117 &host_list_value)) { 117 &host_list_value)) {
118 if (host_list_value->GetSize() >
119 schema_constants::kMaxItemsURLPatternSet) {
120 LOG(WARNING) << "Exceeded maximum number of URL match patterns ("
121 << schema_constants::kMaxItemsURLPatternSet
122 << ") for attribute '" << key << "'";
123 return false;
124 }
125
118 out_value->ClearPatterns(); 126 out_value->ClearPatterns();
119 const int extension_scheme_mask = 127 const int extension_scheme_mask =
120 URLPattern::GetValidSchemeMaskForExtensions(); 128 URLPattern::GetValidSchemeMaskForExtensions();
121 for (size_t i = 0; i < host_list_value->GetSize(); ++i) { 129 for (size_t i = 0; i < host_list_value->GetSize(); ++i) {
122 std::string unparsed_str; 130 std::string unparsed_str;
123 host_list_value->GetString(i, &unparsed_str); 131 host_list_value->GetString(i, &unparsed_str);
124 URLPattern pattern = URLPattern(extension_scheme_mask); 132 URLPattern pattern = URLPattern(extension_scheme_mask);
125 URLPattern::ParseResult parse_result = pattern.Parse(unparsed_str); 133 URLPattern::ParseResult parse_result = pattern.Parse(
134 unparsed_str, URLPattern::ALLOW_WILDCARD_FOR_EFFECTIVE_TLD);
126 if (parse_result != URLPattern::PARSE_SUCCESS) { 135 if (parse_result != URLPattern::PARSE_SUCCESS) {
127 LOG(WARNING) << kMalformedPreferenceWarning; 136 LOG(WARNING) << kMalformedPreferenceWarning;
128 LOG(WARNING) << "Invalid URL pattern '" + unparsed_str + 137 LOG(WARNING) << "Invalid URL pattern '" + unparsed_str +
129 "' for attribute " + key; 138 "' for attribute " + key;
130 return false; 139 return false;
131 } 140 }
132 out_value->AddPattern(pattern); 141 out_value->AddPattern(pattern);
133 } 142 }
134 } 143 }
135 return true; 144 return true;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 void GlobalSettings::Reset() { 189 void GlobalSettings::Reset() {
181 has_restricted_install_sources = false; 190 has_restricted_install_sources = false;
182 install_sources.ClearPatterns(); 191 install_sources.ClearPatterns();
183 has_restricted_allowed_types = false; 192 has_restricted_allowed_types = false;
184 allowed_types.clear(); 193 allowed_types.clear();
185 } 194 }
186 195
187 } // namespace internal 196 } // namespace internal
188 197
189 } // namespace extensions 198 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management_constants.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698