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

Unified Diff: chrome/common/extensions/url_pattern_set.h

Issue 7347011: Update URLPatternSet to contain a std::set instead of std::vector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows compile errors. Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/url_pattern.cc ('k') | chrome/common/extensions/url_pattern_set.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/url_pattern_set.h
diff --git a/chrome/common/extensions/url_pattern_set.h b/chrome/common/extensions/url_pattern_set.h
index 2120e547e41506390641506cbcfc1b36f20e31ee..1848e746247f042223c9a4cfa2d8fdedec1ca1c4 100644
--- a/chrome/common/extensions/url_pattern_set.h
+++ b/chrome/common/extensions/url_pattern_set.h
@@ -6,7 +6,7 @@
#define CHROME_COMMON_EXTENSIONS_URL_PATTERN_SET_H_
#pragma once
-#include <vector>
+#include <set>
#include "chrome/common/extensions/url_pattern.h"
@@ -15,20 +15,27 @@ class GURL;
// Represents the set of URLs an extension uses for web content.
class URLPatternSet {
public:
+ typedef std::set<URLPattern>::const_iterator const_iterator;
+ typedef std::set<URLPattern>::iterator iterator;
+
// Clears |out| and populates the set with the union of |set1| and |set2|.
- // NOTE: this does not discard duplicates.
static void CreateUnion(const URLPatternSet& set1,
const URLPatternSet& set2,
URLPatternSet* out);
URLPatternSet();
URLPatternSet(const URLPatternSet& rhs);
+ explicit URLPatternSet(const std::set<URLPattern>& patterns);
~URLPatternSet();
+
URLPatternSet& operator=(const URLPatternSet& rhs);
+ bool operator==(const URLPatternSet& rhs) const;
bool is_empty() const;
+ const std::set<URLPattern>& patterns() const { return patterns_; }
+ const_iterator begin() const { return patterns_.begin(); }
+ const_iterator end() const { return patterns_.end(); }
- const URLPatternList& patterns() const { return patterns_; }
void AddPattern(const URLPattern& pattern);
void ClearPatterns();
@@ -40,7 +47,7 @@ class URLPatternSet {
private:
// The list of URL patterns that comprise the extent.
- URLPatternList patterns_;
+ std::set<URLPattern> patterns_;
};
#endif // CHROME_COMMON_EXTENSIONS_URL_PATTERN_SET_H_
« no previous file with comments | « chrome/common/extensions/url_pattern.cc ('k') | chrome/common/extensions/url_pattern_set.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698