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

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

Issue 7003098: Start refractoring extension permissions into ExtensionPermissionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: See if rebasing fixes the tests... Created 9 years, 6 months 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 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 // Clears |out| and populates the set with the union of |set1| and |set2|.
19 // NOTE: this does not discard duplicates.
20 static void CreateUnion(const URLPatternSet& set1,
21 const URLPatternSet& set2,
22 URLPatternSet* out);
23
18 URLPatternSet(); 24 URLPatternSet();
19 URLPatternSet(const URLPatternSet& rhs); 25 URLPatternSet(const URLPatternSet& rhs);
20 ~URLPatternSet(); 26 ~URLPatternSet();
21 URLPatternSet& operator=(const URLPatternSet& rhs); 27 URLPatternSet& operator=(const URLPatternSet& rhs);
22 28
23 bool is_empty() const; 29 bool is_empty() const;
24 30
25 const URLPatternList& patterns() const { return patterns_; } 31 const URLPatternList& patterns() const { return patterns_; }
26 void AddPattern(const URLPattern& pattern); 32 void AddPattern(const URLPattern& pattern);
27 void ClearPatterns(); 33 void ClearPatterns();
28 34
29 // Test if the extent contains a URL. 35 // Test if the extent contains a URL.
30 bool MatchesURL(const GURL& url) const; 36 bool MatchesURL(const GURL& url) const;
31 37
32 // Returns true if there is a single URL that would be in two extents. 38 // Returns true if there is a single URL that would be in two extents.
33 bool OverlapsWith(const URLPatternSet& other) const; 39 bool OverlapsWith(const URLPatternSet& other) const;
34 40
35 private: 41 private:
36 // The list of URL patterns that comprise the extent. 42 // The list of URL patterns that comprise the extent.
37 URLPatternList patterns_; 43 URLPatternList patterns_;
38 }; 44 };
39 45
40 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_SET_H_ 46 #endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_SET_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_unittest.cc ('k') | chrome/common/extensions/url_pattern_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698