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

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

Issue 2808051: Refactored extension privilege enumeration and implemented URLPattern compari... (Closed) Base URL: svn://chrome-svn/chrome/trunk/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 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
« 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