OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXTENSION_EXTENT_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_ |
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_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 class GURL; |
12 #include "googleurl/src/gurl.h" | 12 class URLPattern; |
13 | 13 |
14 // Represents the set of URLs an extension uses for web content. | 14 // Represents the set of URLs an extension uses for web content. |
15 class ExtensionExtent { | 15 class ExtensionExtent { |
16 public: | 16 public: |
17 typedef std::vector<URLPattern> PatternList; | 17 typedef std::vector<URLPattern> PatternList; |
18 | 18 |
19 bool is_empty() const { return patterns_.empty(); } | 19 ExtensionExtent(); |
| 20 ExtensionExtent(const ExtensionExtent& rhs); |
| 21 ~ExtensionExtent(); |
| 22 ExtensionExtent& operator=(const ExtensionExtent& rhs); |
| 23 |
| 24 bool is_empty() const; |
20 | 25 |
21 const PatternList& patterns() const { return patterns_; } | 26 const PatternList& patterns() const { return patterns_; } |
22 void AddPattern(const URLPattern& pattern) { patterns_.push_back(pattern); } | 27 void AddPattern(const URLPattern& pattern); |
23 void ClearPaths() { patterns_.clear(); } | 28 void ClearPaths(); |
24 | 29 |
25 // Test if the extent contains a URL. | 30 // Test if the extent contains a URL. |
26 bool ContainsURL(const GURL& url) const; | 31 bool ContainsURL(const GURL& url) const; |
27 | 32 |
28 // Returns true if there is a single URL that would be in two extents. | 33 // Returns true if there is a single URL that would be in two extents. |
29 bool OverlapsWith(const ExtensionExtent& other) const; | 34 bool OverlapsWith(const ExtensionExtent& other) const; |
30 | 35 |
31 private: | 36 private: |
32 // The list of URL patterns that comprise the extent. | 37 // The list of URL patterns that comprise the extent. |
33 PatternList patterns_; | 38 PatternList patterns_; |
34 }; | 39 }; |
35 | 40 |
36 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_ | 41 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_ |
OLD | NEW |