OLD | NEW |
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 #ifndef EXTENSIONS_COMMON_URL_PATTERN_H_ | 4 #ifndef EXTENSIONS_COMMON_URL_PATTERN_H_ |
5 #define EXTENSIONS_COMMON_URL_PATTERN_H_ | 5 #define EXTENSIONS_COMMON_URL_PATTERN_H_ |
6 | 6 |
7 #include <functional> | 7 #include <functional> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 class EffectiveHostCompareFunctor { | 182 class EffectiveHostCompareFunctor { |
183 public: | 183 public: |
184 bool operator()(const URLPattern& a, const URLPattern& b) const { | 184 bool operator()(const URLPattern& a, const URLPattern& b) const { |
185 return EffectiveHostCompare(a, b); | 185 return EffectiveHostCompare(a, b); |
186 }; | 186 }; |
187 }; | 187 }; |
188 | 188 |
189 // Get an error string for a ParseResult. | 189 // Get an error string for a ParseResult. |
190 static const char* GetParseResultString(URLPattern::ParseResult parse_result); | 190 static const char* GetParseResultString(URLPattern::ParseResult parse_result); |
191 | 191 |
192 // Checks whether the bit is set for the given scheme in the given scheme mask | |
193 static bool IsSchemeBitSet(const std::string& scheme, const int mask); | |
194 | |
195 private: | 192 private: |
196 // Returns true if any of the |schemes| items matches our scheme. | 193 // Returns true if any of the |schemes| items matches our scheme. |
197 bool MatchesAnyScheme(const std::vector<std::string>& schemes) const; | 194 bool MatchesAnyScheme(const std::vector<std::string>& schemes) const; |
198 | 195 |
199 // Returns true if all of the |schemes| items matches our scheme. | 196 // Returns true if all of the |schemes| items matches our scheme. |
200 bool MatchesAllSchemes(const std::vector<std::string>& schemes) const; | 197 bool MatchesAllSchemes(const std::vector<std::string>& schemes) const; |
201 | 198 |
202 bool MatchesSecurityOriginHelper(const GURL& test) const; | 199 bool MatchesSecurityOriginHelper(const GURL& test) const; |
203 | 200 |
204 // Returns true if our port matches the |port| pattern (it may be "*"). | 201 // Returns true if our port matches the |port| pattern (it may be "*"). |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 // MatchPattern() function. | 234 // MatchPattern() function. |
238 std::string path_escaped_; | 235 std::string path_escaped_; |
239 | 236 |
240 // A string representing this URLPattern. | 237 // A string representing this URLPattern. |
241 mutable std::string spec_; | 238 mutable std::string spec_; |
242 }; | 239 }; |
243 | 240 |
244 typedef std::vector<URLPattern> URLPatternList; | 241 typedef std::vector<URLPattern> URLPatternList; |
245 | 242 |
246 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ | 243 #endif // EXTENSIONS_COMMON_URL_PATTERN_H_ |
OLD | NEW |