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

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, 6 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 | « no previous file | chrome/browser/content_settings/content_settings_pattern.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5bfb6d8fe766d60812682a25ec0c379db8e28f3e..445d0cd2cb135ec442d942a7d52e27323e042d52 100644
--- a/chrome/browser/content_settings/content_settings_pattern.h
+++ b/chrome/browser/content_settings/content_settings_pattern.h
@@ -26,21 +26,33 @@ class ContentSettingsPattern {
// Each content settings pattern describes a set of origins. Patterns, and the
// 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)|) interesting relations are:
- // - IDENTITY: Pattern A and B are identical. The patterns are equal.
- // - DISJOINT: Pattern A and B have no intersection. A and B never both
- // match the origin of a URL.
- // - 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.
+ // (A compare B) interesting relations are:
+ // - IDENTITY:
+ // 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;
« no previous file with comments | « no previous file | chrome/browser/content_settings/content_settings_pattern.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698