OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef COMPONENTS_URL_MATCHER_URL_MATCHER_H_ | 5 #ifndef COMPONENTS_URL_MATCHER_URL_MATCHER_H_ |
6 #define COMPONENTS_URL_MATCHER_URL_MATCHER_H_ | 6 #define COMPONENTS_URL_MATCHER_URL_MATCHER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 static Range CreateRange(int port); | 296 static Range CreateRange(int port); |
297 | 297 |
298 private: | 298 private: |
299 std::vector<Range> ranges_; | 299 std::vector<Range> ranges_; |
300 | 300 |
301 DISALLOW_COPY_AND_ASSIGN(URLMatcherPortFilter); | 301 DISALLOW_COPY_AND_ASSIGN(URLMatcherPortFilter); |
302 }; | 302 }; |
303 | 303 |
304 // This class represents a set of conditions that all need to match on a | 304 // This class represents a set of conditions that all need to match on a |
305 // given URL in order to be considered a match. | 305 // given URL in order to be considered a match. |
| 306 // TODO(mgiuca): Avoid using UnsafeRefCounted. http://crbug.com/469952. |
306 class URL_MATCHER_EXPORT URLMatcherConditionSet | 307 class URL_MATCHER_EXPORT URLMatcherConditionSet |
307 : public base::RefCounted<URLMatcherConditionSet> { | 308 : public base::UnsafeRefCounted<URLMatcherConditionSet> { |
308 public: | 309 public: |
309 typedef int ID; | 310 typedef int ID; |
310 typedef std::set<URLMatcherCondition> Conditions; | 311 typedef std::set<URLMatcherCondition> Conditions; |
311 typedef std::set<URLQueryElementMatcherCondition> QueryConditions; | 312 typedef std::set<URLQueryElementMatcherCondition> QueryConditions; |
312 typedef std::vector<scoped_refptr<URLMatcherConditionSet> > Vector; | 313 typedef std::vector<scoped_refptr<URLMatcherConditionSet> > Vector; |
313 | 314 |
314 // Matches if all conditions in |conditions| are fulfilled. | 315 // Matches if all conditions in |conditions| are fulfilled. |
315 URLMatcherConditionSet(ID id, const Conditions& conditions); | 316 URLMatcherConditionSet(ID id, const Conditions& conditions); |
316 | 317 |
317 // Matches if all conditions in |conditions|, |scheme_filter| and | 318 // Matches if all conditions in |conditions|, |scheme_filter| and |
(...skipping 18 matching lines...) Expand all Loading... |
336 const QueryConditions& query_conditions() const { return query_conditions_; } | 337 const QueryConditions& query_conditions() const { return query_conditions_; } |
337 | 338 |
338 bool IsMatch(const std::set<StringPattern::ID>& matching_patterns, | 339 bool IsMatch(const std::set<StringPattern::ID>& matching_patterns, |
339 const GURL& url) const; | 340 const GURL& url) const; |
340 | 341 |
341 bool IsMatch(const std::set<StringPattern::ID>& matching_patterns, | 342 bool IsMatch(const std::set<StringPattern::ID>& matching_patterns, |
342 const GURL& url, | 343 const GURL& url, |
343 const std::string& url_for_component_searches) const; | 344 const std::string& url_for_component_searches) const; |
344 | 345 |
345 private: | 346 private: |
346 friend class base::RefCounted<URLMatcherConditionSet>; | 347 friend class base::UnsafeRefCounted<URLMatcherConditionSet>; |
347 ~URLMatcherConditionSet(); | 348 ~URLMatcherConditionSet(); |
348 ID id_; | 349 ID id_; |
349 Conditions conditions_; | 350 Conditions conditions_; |
350 QueryConditions query_conditions_; | 351 QueryConditions query_conditions_; |
351 scoped_ptr<URLMatcherSchemeFilter> scheme_filter_; | 352 scoped_ptr<URLMatcherSchemeFilter> scheme_filter_; |
352 scoped_ptr<URLMatcherPortFilter> port_filter_; | 353 scoped_ptr<URLMatcherPortFilter> port_filter_; |
353 | 354 |
354 DISALLOW_COPY_AND_ASSIGN(URLMatcherConditionSet); | 355 DISALLOW_COPY_AND_ASSIGN(URLMatcherConditionSet); |
355 }; | 356 }; |
356 | 357 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 RegexSetMatcher origin_and_path_regex_set_matcher_; | 418 RegexSetMatcher origin_and_path_regex_set_matcher_; |
418 std::set<const StringPattern*> registered_full_url_patterns_; | 419 std::set<const StringPattern*> registered_full_url_patterns_; |
419 std::set<const StringPattern*> registered_url_component_patterns_; | 420 std::set<const StringPattern*> registered_url_component_patterns_; |
420 | 421 |
421 DISALLOW_COPY_AND_ASSIGN(URLMatcher); | 422 DISALLOW_COPY_AND_ASSIGN(URLMatcher); |
422 }; | 423 }; |
423 | 424 |
424 } // namespace url_matcher | 425 } // namespace url_matcher |
425 | 426 |
426 #endif // COMPONENTS_URL_MATCHER_URL_MATCHER_H_ | 427 #endif // COMPONENTS_URL_MATCHER_URL_MATCHER_H_ |
OLD | NEW |