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

Side by Side Diff: chrome/common/extensions/url_pattern.h

Issue 8312005: Ignore paths when matching patterns for extensions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix silly typo. Created 9 years, 1 month 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 #ifndef CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ 4 #ifndef CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_
5 #define CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ 5 #define CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_
6 #pragma once 6 #pragma once
7 7
8 #include <functional> 8 #include <functional>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // absolutely need the exact scheme. This is exposed for testing. 184 // absolutely need the exact scheme. This is exposed for testing.
185 const std::string& scheme() const { return scheme_; } 185 const std::string& scheme() const { return scheme_; }
186 186
187 // Returns true if the specified scheme can be used in this URL pattern, and 187 // Returns true if the specified scheme can be used in this URL pattern, and
188 // false otherwise. Uses valid_schemes_ to determine validity. 188 // false otherwise. Uses valid_schemes_ to determine validity.
189 bool IsValidScheme(const std::string& scheme) const; 189 bool IsValidScheme(const std::string& scheme) const;
190 190
191 // Returns true if this instance matches the specified URL. 191 // Returns true if this instance matches the specified URL.
192 bool MatchesURL(const GURL& test) const; 192 bool MatchesURL(const GURL& test) const;
193 193
194 bool MatchesSecurityOrigin(const GURL& test) const;
Aaron Boodman 2011/10/31 23:57:11 comment?
dcheng 2011/11/01 22:04:04 Done.
195
194 // Returns true if |test| matches our scheme. 196 // Returns true if |test| matches our scheme.
195 bool MatchesScheme(const std::string& test) const; 197 bool MatchesScheme(const std::string& test) const;
196 198
197 // Returns true if |test| matches our host. 199 // Returns true if |test| matches our host.
198 bool MatchesHost(const std::string& test) const; 200 bool MatchesHost(const std::string& test) const;
199 bool MatchesHost(const GURL& test) const; 201 bool MatchesHost(const GURL& test) const;
200 202
201 // Returns true if |test| matches our path. 203 // Returns true if |test| matches our path.
202 bool MatchesPath(const std::string& test) const; 204 bool MatchesPath(const std::string& test) const;
203 205
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 }; 238 };
237 }; 239 };
238 240
239 // Get an error string for a ParseResult. 241 // Get an error string for a ParseResult.
240 static const char* GetParseResultString(URLPattern::ParseResult parse_result); 242 static const char* GetParseResultString(URLPattern::ParseResult parse_result);
241 243
242 private: 244 private:
243 // Returns true if any of the |schemes| items matches our scheme. 245 // Returns true if any of the |schemes| items matches our scheme.
244 bool MatchesAnyScheme(const std::vector<std::string>& schemes) const; 246 bool MatchesAnyScheme(const std::vector<std::string>& schemes) const;
245 247
248 bool MatchesSecurityOriginHelper(const GURL& test) const;
249
246 // If the URLPattern contains a wildcard scheme, returns a list of 250 // If the URLPattern contains a wildcard scheme, returns a list of
247 // equivalent literal schemes, otherwise returns the current scheme. 251 // equivalent literal schemes, otherwise returns the current scheme.
248 std::vector<std::string> GetExplicitSchemes() const; 252 std::vector<std::string> GetExplicitSchemes() const;
249 253
250 // A bitmask containing the schemes which are considered valid for this 254 // A bitmask containing the schemes which are considered valid for this
251 // pattern. Parse() uses this to decide whether a pattern contains a valid 255 // pattern. Parse() uses this to decide whether a pattern contains a valid
252 // scheme. MatchesScheme uses this to decide whether a wildcard scheme_ 256 // scheme. MatchesScheme uses this to decide whether a wildcard scheme_
253 // matches a given test scheme. 257 // matches a given test scheme.
254 int valid_schemes_; 258 int valid_schemes_;
255 259
(...skipping 22 matching lines...) Expand all
278 // MatchPattern() function. 282 // MatchPattern() function.
279 std::string path_escaped_; 283 std::string path_escaped_;
280 284
281 // A string representing this URLPattern. 285 // A string representing this URLPattern.
282 mutable std::string spec_; 286 mutable std::string spec_;
283 }; 287 };
284 288
285 typedef std::vector<URLPattern> URLPatternList; 289 typedef std::vector<URLPattern> URLPatternList;
286 290
287 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ 291 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698