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

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

Issue 2495353003: chrome.webRequest support for ExtensionSettings (Closed)
Patch Set: Policy template translation doesn't like '&', switching to 'and'. Small fix to browser test. Created 3 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/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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 return false; 126 return false;
127 } 127 }
128 128
129 out_value->ClearPatterns(); 129 out_value->ClearPatterns();
130 const int extension_scheme_mask = 130 const int extension_scheme_mask =
131 URLPattern::GetValidSchemeMaskForExtensions(); 131 URLPattern::GetValidSchemeMaskForExtensions();
132 for (size_t i = 0; i < host_list_value->GetSize(); ++i) { 132 for (size_t i = 0; i < host_list_value->GetSize(); ++i) {
133 std::string unparsed_str; 133 std::string unparsed_str;
134 host_list_value->GetString(i, &unparsed_str); 134 host_list_value->GetString(i, &unparsed_str);
135 URLPattern pattern = URLPattern(extension_scheme_mask); 135 URLPattern pattern = URLPattern(extension_scheme_mask);
136 URLPattern::ParseResult parse_result = pattern.Parse( 136 URLPattern::ParseResult parse_result;
137 unparsed_str, URLPattern::ALLOW_WILDCARD_FOR_EFFECTIVE_TLD); 137 if (unparsed_str == "<all_urls>") {
138 parse_result = pattern.Parse(
139 unparsed_str, URLPattern::ALLOW_WILDCARD_FOR_EFFECTIVE_TLD);
140 } else {
141 parse_result =
142 pattern.Parse(unparsed_str + "/*",
143 URLPattern::ALLOW_WILDCARD_FOR_EFFECTIVE_TLD);
144 }
138 if (parse_result != URLPattern::PARSE_SUCCESS) { 145 if (parse_result != URLPattern::PARSE_SUCCESS) {
139 LOG(WARNING) << kMalformedPreferenceWarning; 146 LOG(WARNING) << kMalformedPreferenceWarning;
140 LOG(WARNING) << "Invalid URL pattern '" + unparsed_str + 147 LOG(WARNING) << "Invalid URL pattern '" + unparsed_str +
141 "' for attribute " + key; 148 "' for attribute " + key;
142 return false; 149 return false;
143 } 150 }
144 out_value->AddPattern(pattern); 151 out_value->AddPattern(pattern);
145 } 152 }
146 } 153 }
147 return true; 154 return true;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void GlobalSettings::Reset() { 209 void GlobalSettings::Reset() {
203 has_restricted_install_sources = false; 210 has_restricted_install_sources = false;
204 install_sources.ClearPatterns(); 211 install_sources.ClearPatterns();
205 has_restricted_allowed_types = false; 212 has_restricted_allowed_types = false;
206 allowed_types.clear(); 213 allowed_types.clear();
207 } 214 }
208 215
209 } // namespace internal 216 } // namespace internal
210 217
211 } // namespace extensions 218 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698