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

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

Issue 3173018: Merge 55103 - Refactored extension privilege enumeration and implemented URLP... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/472/src/
Patch Set: Created 10 years, 4 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
Index: chrome/common/extensions/url_pattern.h
===================================================================
--- chrome/common/extensions/url_pattern.h (revision 56058)
+++ chrome/common/extensions/url_pattern.h (working copy)
@@ -4,6 +4,7 @@
#ifndef CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_
#define CHROME_COMMON_EXTENSIONS_URL_PATTERN_H_
+#include <functional>
#include <string>
#include <vector>
@@ -163,6 +164,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
« no previous file with comments | « chrome/common/extensions/extension_unittest.cc ('k') | chrome/test/data/extensions/origin_privileges/extension/manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698