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

Side by Side Diff: components/content_settings/core/common/content_settings_pattern.h

Issue 2728503003: Update permission warning for contentSettings API
Patch Set: chrome.contentSettings API: Do not allow wildcard patterns that match extension URLs Created 3 years, 9 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 (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 // Patterns used in content setting rules. 5 // Patterns used in content setting rules.
6 6
7 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_ 7 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_
8 #define COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_ 8 #define COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_
9 9
10 #include <string> 10 #include <string>
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // Constructs an empty pattern. Empty patterns are invalid patterns. Invalid 183 // Constructs an empty pattern. Empty patterns are invalid patterns. Invalid
184 // patterns match nothing. 184 // patterns match nothing.
185 ContentSettingsPattern(); 185 ContentSettingsPattern();
186 186
187 // True if this is a valid pattern. 187 // True if this is a valid pattern.
188 bool IsValid() const { return is_valid_; } 188 bool IsValid() const { return is_valid_; }
189 189
190 // True if |url| matches this pattern. 190 // True if |url| matches this pattern.
191 bool Matches(const GURL& url) const; 191 bool Matches(const GURL& url) const;
192 192
193 // True if the pattern matches multiple extension URLs (i.e. the scheme is
194 // a wildcard and the hostname is either a wildcard or looks like an extension
195 // ID).
196 bool IsExtensionUrlWildcard() const;
197
193 // True if this pattern matches all hosts (i.e. it has a host wildcard). 198 // True if this pattern matches all hosts (i.e. it has a host wildcard).
194 bool MatchesAllHosts() const; 199 bool MatchesAllHosts() const;
195 200
196 // Returns a std::string representation of this pattern. 201 // Returns a std::string representation of this pattern.
197 std::string ToString() const; 202 std::string ToString() const;
198 203
199 // Returns scheme type of pattern. 204 // Returns scheme type of pattern.
200 ContentSettingsPattern::SchemeType GetScheme() const; 205 ContentSettingsPattern::SchemeType GetScheme() const;
201 206
202 // True if this pattern has a non-empty path. Can only be used for patterns 207 // True if this pattern has a non-empty path. Can only be used for patterns
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 const ContentSettingsPattern::PatternParts& other_parts); 250 const ContentSettingsPattern::PatternParts& other_parts);
246 251
247 ContentSettingsPattern(const PatternParts& parts, bool valid); 252 ContentSettingsPattern(const PatternParts& parts, bool valid);
248 253
249 PatternParts parts_; 254 PatternParts parts_;
250 255
251 bool is_valid_; 256 bool is_valid_;
252 }; 257 };
253 258
254 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_ 259 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_COMMON_CONTENT_SETTINGS_PATTERN_H_
OLDNEW
« no previous file with comments | « components/content_settings/core/common/DEPS ('k') | components/content_settings/core/common/content_settings_pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698