Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROME_COMMON_EXTENSIONS_URL_PATTERN_SET_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_URL_PATTERN_SET_H_ |
| 6 #define CHROME_COMMON_EXTENSIONS_URL_PATTERN_SET_H_ | 6 #define CHROME_COMMON_EXTENSIONS_URL_PATTERN_SET_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "chrome/common/extensions/url_pattern.h" | 11 #include "chrome/common/extensions/url_pattern.h" |
| 12 | 12 |
| 13 class GURL; | 13 class GURL; |
| 14 | 14 |
| 15 // Represents the set of URLs an extension uses for web content. | 15 // Represents the set of URLs an extension uses for web content. |
| 16 class URLPatternSet { | 16 class URLPatternSet { |
| 17 public: | 17 public: |
| 18 // Passes ownership to caller. | |
|
Matt Perry
2011/06/21 00:43:10
ownership of what?
jstritar
2011/06/21 23:12:16
Oops, I had originally been returning a pointer to
| |
| 19 static void CreateUnion(const URLPatternSet& set1, | |
| 20 const URLPatternSet& set2, | |
| 21 URLPatternSet* out); | |
| 22 | |
| 18 URLPatternSet(); | 23 URLPatternSet(); |
| 19 URLPatternSet(const URLPatternSet& rhs); | 24 URLPatternSet(const URLPatternSet& rhs); |
| 20 ~URLPatternSet(); | 25 ~URLPatternSet(); |
| 21 URLPatternSet& operator=(const URLPatternSet& rhs); | 26 URLPatternSet& operator=(const URLPatternSet& rhs); |
| 22 | 27 |
| 23 bool is_empty() const; | 28 bool is_empty() const; |
| 24 | 29 |
| 25 const URLPatternList& patterns() const { return patterns_; } | 30 const URLPatternList& patterns() const { return patterns_; } |
| 26 void AddPattern(const URLPattern& pattern); | 31 void AddPattern(const URLPattern& pattern); |
| 27 void ClearPatterns(); | 32 void ClearPatterns(); |
| 28 | 33 |
| 29 // Test if the extent contains a URL. | 34 // Test if the extent contains a URL. |
| 30 bool MatchesURL(const GURL& url) const; | 35 bool MatchesURL(const GURL& url) const; |
| 31 | 36 |
| 32 // Returns true if there is a single URL that would be in two extents. | 37 // Returns true if there is a single URL that would be in two extents. |
| 33 bool OverlapsWith(const URLPatternSet& other) const; | 38 bool OverlapsWith(const URLPatternSet& other) const; |
| 34 | 39 |
| 35 private: | 40 private: |
| 36 // The list of URL patterns that comprise the extent. | 41 // The list of URL patterns that comprise the extent. |
| 37 URLPatternList patterns_; | 42 URLPatternList patterns_; |
| 38 }; | 43 }; |
| 39 | 44 |
| 40 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_SET_H_ | 45 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_SET_H_ |
| OLD | NEW |