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

Side by Side Diff: chrome/common/content_settings_pattern.h

Issue 7831075: Delegating the "are images allowed" decision to renderer. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Test build fixes. Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ 7 #ifndef CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_
8 #define CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ 8 #define CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_
9 #pragma once 9 #pragma once
10 10
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 // Returns true if the pattern and the |other| pattern are not identical. 139 // Returns true if the pattern and the |other| pattern are not identical.
140 bool operator!=(const ContentSettingsPattern& other) const; 140 bool operator!=(const ContentSettingsPattern& other) const;
141 141
142 // Returns true if the pattern has a lower priority than the |other| pattern. 142 // Returns true if the pattern has a lower priority than the |other| pattern.
143 bool operator<(const ContentSettingsPattern& other) const; 143 bool operator<(const ContentSettingsPattern& other) const;
144 144
145 // Returns true if the pattern has a higher priority than the |other| pattern. 145 // Returns true if the pattern has a higher priority than the |other| pattern.
146 bool operator>(const ContentSettingsPattern& other) const; 146 bool operator>(const ContentSettingsPattern& other) const;
147 147
148 private: 148 // Public for serializing and sending |ContentSettingsPattern| over IPC.
149 friend class content_settings::PatternParser;
150 friend class ContentSettingsPatternParserTest_SerializePatterns_Test;
151 friend class Builder;
152
153 struct PatternParts { 149 struct PatternParts {
154 PatternParts(); 150 PatternParts();
155 ~PatternParts(); 151 ~PatternParts();
156 152
157 // Lowercase string of the URL scheme to match. This string is empty if the 153 // Lowercase string of the URL scheme to match. This string is empty if the
158 // |is_scheme_wildcard| flag is set. 154 // |is_scheme_wildcard| flag is set.
159 std::string scheme; 155 std::string scheme;
160 156
161 // True if the scheme wildcard is set. 157 // True if the scheme wildcard is set.
162 bool is_scheme_wildcard; 158 bool is_scheme_wildcard;
(...skipping 13 matching lines...) Expand all
176 std::string port; 172 std::string port;
177 173
178 // True if the port wildcard is set. 174 // True if the port wildcard is set.
179 bool is_port_wildcard; 175 bool is_port_wildcard;
180 176
181 // TODO(markusheintz): Needed for legacy reasons. Remove. Path 177 // TODO(markusheintz): Needed for legacy reasons. Remove. Path
182 // specification. Only used for content settings pattern with a "file" 178 // specification. Only used for content settings pattern with a "file"
183 // scheme part. 179 // scheme part.
184 std::string path; 180 std::string path;
185 }; 181 };
182 PatternParts parts_;
183 bool is_valid_;
184
185 private:
186 friend class content_settings::PatternParser;
187 friend class ContentSettingsPatternParserTest_SerializePatterns_Test;
188 friend class Builder;
186 189
187 class Builder : public BuilderInterface { 190 class Builder : public BuilderInterface {
188 public: 191 public:
189 explicit Builder(bool use_legacy_validate); 192 explicit Builder(bool use_legacy_validate);
190 virtual ~Builder(); 193 virtual ~Builder();
191 194
192 // Overrides BuilderInterface 195 // Overrides BuilderInterface
193 virtual BuilderInterface* WithPort(const std::string& port); 196 virtual BuilderInterface* WithPort(const std::string& port);
194 197
195 virtual BuilderInterface* WithPortWildcard(); 198 virtual BuilderInterface* WithPortWildcard();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 const ContentSettingsPattern::PatternParts& parts, 237 const ContentSettingsPattern::PatternParts& parts,
235 const ContentSettingsPattern::PatternParts& other_parts); 238 const ContentSettingsPattern::PatternParts& other_parts);
236 239
237 static Relation ComparePort( 240 static Relation ComparePort(
238 const ContentSettingsPattern::PatternParts& parts, 241 const ContentSettingsPattern::PatternParts& parts,
239 const ContentSettingsPattern::PatternParts& other_parts); 242 const ContentSettingsPattern::PatternParts& other_parts);
240 243
241 static bool Validate(const PatternParts& parts); 244 static bool Validate(const PatternParts& parts);
242 245
243 ContentSettingsPattern(const PatternParts& parts, bool valid); 246 ContentSettingsPattern(const PatternParts& parts, bool valid);
244
245 PatternParts parts_;
246
247 bool is_valid_;
248 }; 247 };
249 248
250 // Stream operator so ContentSettingsPattern can be used in assertion 249 // Stream operator so ContentSettingsPattern can be used in assertion
251 // statements. 250 // statements.
252 inline std::ostream& operator<<( 251 inline std::ostream& operator<<(
253 std::ostream& out, const ContentSettingsPattern& pattern) { 252 std::ostream& out, const ContentSettingsPattern& pattern) {
254 return out << pattern.ToString(); 253 return out << pattern.ToString();
255 } 254 }
256 255
257 #endif // CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ 256 #endif // CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698