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

Side by Side Diff: chrome/common/content_settings_pattern_parser.cc

Issue 13251012: Fix b180514: Some exception entries cannot be deleted from a setting panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Refactoring Created 7 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
« no previous file with comments | « no previous file | chrome/common/content_settings_pattern_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/content_settings_pattern_parser.h" 5 #include "chrome/common/content_settings_pattern_parser.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/common/url_constants.h" 8 #include "chrome/common/url_constants.h"
9 #include "extensions/common/constants.h" 9 #include "extensions/common/constants.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } else { 132 } else {
133 builder->WithScheme(scheme); 133 builder->WithScheme(scheme);
134 } 134 }
135 } else { 135 } else {
136 builder->WithSchemeWildcard(); 136 builder->WithSchemeWildcard();
137 } 137 }
138 138
139 if (host_component.IsNonEmpty()) { 139 if (host_component.IsNonEmpty()) {
140 std::string host = pattern_spec.substr(host_component.start, 140 std::string host = pattern_spec.substr(host_component.start,
141 host_component.len); 141 host_component.len);
142 if (host == "." || host.find("..") != std::string::npos) {
jochen (gone - plz use gerrit) 2013/04/03 09:12:36 sorry for being late to the party I would expect
markusheintz_ 2013/04/03 09:48:40 Do you have any particular checks do you have in m
yhirano 2013/04/03 09:59:10 Let me clarify. As you say, Builder::Validate() is
143 builder->Invalid();
144 return;
145 }
146
142 if (host == kHostWildcard) { 147 if (host == kHostWildcard) {
143 builder->WithDomainWildcard(); 148 builder->WithDomainWildcard();
144 } else if (StartsWithASCII(host, kDomainWildcard, true)) { 149 } else if (StartsWithASCII(host, kDomainWildcard, true)) {
145 host = host.substr(kDomainWildcardLength); 150 host = host.substr(kDomainWildcardLength);
146 builder->WithDomainWildcard(); 151 builder->WithDomainWildcard();
147 builder->WithHost(host); 152 builder->WithHost(host);
148 } else { 153 } else {
149 // If the host contains a wildcard symbol then it is invalid. 154 // If the host contains a wildcard symbol then it is invalid.
150 if (host.find(kHostWildcard) != std::string::npos) { 155 if (host.find(kHostWildcard) != std::string::npos) {
151 builder->Invalid(); 156 builder->Invalid();
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 228 }
224 229
225 if (!parts.is_port_wildcard) { 230 if (!parts.is_port_wildcard) {
226 str += std::string(kUrlPortSeparator) + parts.port; 231 str += std::string(kUrlPortSeparator) + parts.port;
227 } 232 }
228 233
229 return str; 234 return str;
230 } 235 }
231 236
232 } // namespace content_settings 237 } // namespace content_settings
OLDNEW
« no previous file with comments | « no previous file | chrome/common/content_settings_pattern_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698