Index: chrome/common/extensions/url_pattern.h |
=================================================================== |
--- chrome/common/extensions/url_pattern.h (revision 54542) |
+++ chrome/common/extensions/url_pattern.h (working copy) |
@@ -5,6 +5,7 @@ |
#define CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_ |
#pragma once |
+#include <functional> |
#include <string> |
#include <vector> |
@@ -164,6 +165,21 @@ |
// equivalent to this instance. |
std::vector<URLPattern> ConvertToExplicitSchemes() const; |
+ static bool EffectiveHostCompare(const URLPattern& a, const URLPattern& b) { |
+ if (a.match_all_urls_ && b.match_all_urls_) |
+ return false; |
+ return a.host_.compare(b.host_) < 0; |
+ }; |
+ |
+ // Used for origin comparisons in a std::set. |
+ class EffectiveHostCompareFunctor : |
+ public std::binary_function<URLPattern, URLPattern, bool> { |
+ public: |
+ bool operator()(const URLPattern& a, const URLPattern& b) const { |
+ return EffectiveHostCompare(a, b); |
+ }; |
+ }; |
+ |
private: |
// A bitmask containing the schemes which are considered valid for this |
// pattern. Parse() uses this to decide whether a pattern contains a valid |