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

Unified Diff: chrome/browser/content_settings/content_settings_pattern.h

Issue 6969095: Allow invalid patterns for comparison; Make the compare method a order relation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 7 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/browser/content_settings/content_settings_pattern.h
diff --git a/chrome/browser/content_settings/content_settings_pattern.h b/chrome/browser/content_settings/content_settings_pattern.h
index 4b55683c81d473f4e99e9afcfe1fc09d72a86723..1b2f8fc1754f5022f39e9e14e440d7707ce9213e 100644
--- a/chrome/browser/content_settings/content_settings_pattern.h
+++ b/chrome/browser/content_settings/content_settings_pattern.h
@@ -27,20 +27,32 @@ class ContentSettingsPattern {
// sets they describe, have specific relations. |Relation| describes the
// relation of two patterns A and B. When pattern A is compared with pattern B
// (A compare B) interessting relations are:
Bernhard Bauer 2011/06/02 18:39:29 Nit: "interesting", while you're at it :-)
markusheintz_ 2011/06/03 15:20:36 Done.
- // - IDENTITY : Pattern A and B are identical. The patterns are equal.
- // - DISJOINT : Pattern A and B have no intersection. A and B never match
- // a the origin of a URL at the same time.
- // - SUCCESSOR : Pattern A and B have an intersection. But pattern B has a
- // higher precedence than pattern A for URLs that are matched
- // by both pattern.
- // - PREDECESSOR : Pattern A and B have an intersection. But pattern A has a
- // higher precedence than pattern B for URLs that are matched
- // by both pattern.
+ // - IDENTITY :
Bernhard Bauer 2011/06/02 18:39:29 Nit: no space before :
markusheintz_ 2011/06/03 15:20:36 Done. Also below.
+ // Pattern A and B are identical. The patterns are equal.
+ //
+ // - DISJOINT_ORDER_PRE :
+ // Pattern A and B have no intersection. A and B never match the origin of
+ // a URL at the same time. But pattern A has a higher precedence than
+ // pattern B when patterns are sorted.
+ //
+ // - DISJOINT_ORDER_POST :
+ // Pattern A and B have no intersection. A and B never match the origin of
+ // a URL at the same time. But pattern A has a lower precedence than
+ // pattern B when patterns are sorted.
+ //
+ // - SUCCESSOR :
+ // Pattern A and B have an intersection. But pattern B has a higher
+ // precedence than pattern A for URLs that are matched by both pattern.
+ //
+ // - PREDECESSOR :
+ // Pattern A and B have an intersection. But pattern A has a higher
+ // precedence than pattern B for URLs that are matched by both pattern.
enum Relation {
- DISJOINT = -2,
+ DISJOINT_ORDER_POST = -2,
SUCCESSOR = -1,
IDENTITY = 0,
PREDECESSOR = 1,
+ DISJOINT_ORDER_PRE = 2,
};
class BuilderInterface {
@@ -118,9 +130,14 @@ class ContentSettingsPattern {
// |Relation| of the two patterns.
Relation Compare(const ContentSettingsPattern& other) const;
- bool operator==(const ContentSettingsPattern& other) const {
- return Compare(other) == IDENTITY;
- }
+ // Returns true if the pattern and the |other| pattern are identical.
+ bool operator==(const ContentSettingsPattern& other) const;
+
+ // Returns true if the pattern has a lower priority than the |other| pattern.
+ bool operator<(const ContentSettingsPattern& other) const;
+
+ // Returns true if the pattern has a higher priority than the |other| pattern.
+ bool operator>(const ContentSettingsPattern& other) const;
private:
friend class content_settings::PatternParser;

Powered by Google App Engine
This is Rietveld 408576698