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

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

Issue 2820333003: Revert of Communicate ExtensionSettings policy to renderers (Closed)
Patch Set: 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
126 out_value->ClearPatterns(); 118 out_value->ClearPatterns();
127 const int extension_scheme_mask = 119 const int extension_scheme_mask =
128 URLPattern::GetValidSchemeMaskForExtensions(); 120 URLPattern::GetValidSchemeMaskForExtensions();
129 for (size_t i = 0; i < host_list_value->GetSize(); ++i) { 121 for (size_t i = 0; i < host_list_value->GetSize(); ++i) {
130 std::string unparsed_str; 122 std::string unparsed_str;
131 host_list_value->GetString(i, &unparsed_str); 123 host_list_value->GetString(i, &unparsed_str);
132 URLPattern pattern = URLPattern(extension_scheme_mask); 124 URLPattern pattern = URLPattern(extension_scheme_mask);
133 URLPattern::ParseResult parse_result = pattern.Parse( 125 URLPattern::ParseResult parse_result = pattern.Parse(unparsed_str);
134 unparsed_str, URLPattern::ALLOW_WILDCARD_FOR_EFFECTIVE_TLD);
135 if (parse_result != URLPattern::PARSE_SUCCESS) { 126 if (parse_result != URLPattern::PARSE_SUCCESS) {
136 LOG(WARNING) << kMalformedPreferenceWarning; 127 LOG(WARNING) << kMalformedPreferenceWarning;
137 LOG(WARNING) << "Invalid URL pattern '" + unparsed_str + 128 LOG(WARNING) << "Invalid URL pattern '" + unparsed_str +
138 "' for attribute " + key; 129 "' for attribute " + key;
139 return false; 130 return false;
140 } 131 }
141 out_value->AddPattern(pattern); 132 out_value->AddPattern(pattern);
142 } 133 }
143 } 134 }
144 return true; 135 return true;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 void GlobalSettings::Reset() { 180 void GlobalSettings::Reset() {
190 has_restricted_install_sources = false; 181 has_restricted_install_sources = false;
191 install_sources.ClearPatterns(); 182 install_sources.ClearPatterns();
192 has_restricted_allowed_types = false; 183 has_restricted_allowed_types = false;
193 allowed_types.clear(); 184 allowed_types.clear();
194 } 185 }
195 186
196 } // namespace internal 187 } // namespace internal
197 188
198 } // namespace extensions 189 } // 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