diff options
author | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-12 16:57:12 +0000 |
---|---|---|
committer | jochen@chromium.org <jochen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-12 16:57:12 +0000 |
commit | 2c0e5236ef9c18c742be1591fcd310fa2a60e214 (patch) | |
tree | d074909266e839a45b6b25abe5f0827a017a0f61 /chrome/browser/privacy_blacklist/blacklist.h | |
parent | a956916ffd429577a979efa34af889801b8ed44e (diff) | |
download | chromium_src-2c0e5236ef9c18c742be1591fcd310fa2a60e214.zip chromium_src-2c0e5236ef9c18c742be1591fcd310fa2a60e214.tar.gz chromium_src-2c0e5236ef9c18c742be1591fcd310fa2a60e214.tar.bz2 |
Take filter exceptions into account when matching against resource requests.
BUG=16932
TEST=BlacklistTest.Generic
Review URL: http://codereview.chromium.org/541025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36015 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/privacy_blacklist/blacklist.h')
-rw-r--r-- | chrome/browser/privacy_blacklist/blacklist.h | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/chrome/browser/privacy_blacklist/blacklist.h b/chrome/browser/privacy_blacklist/blacklist.h index 44df410..96112f6 100644 --- a/chrome/browser/privacy_blacklist/blacklist.h +++ b/chrome/browser/privacy_blacklist/blacklist.h @@ -84,6 +84,9 @@ class Blacklist { // Bitfield of filter-attributes matching the pattern. unsigned int attributes() const { return attributes_; } + // True if this entry is an exception to the blacklist. + bool is_exception() const { return is_exception_; } + // Provider of this blacklist entry, used for assigning blame ;) const Provider* provider() const { return provider_; } @@ -130,18 +133,27 @@ class Blacklist { class Match : public URLRequest::UserData { public: // Functions that return combined results from all entries. - unsigned int attributes() const { return attributes_; } + unsigned int attributes() const { + return (matching_attributes_ & (~exception_attributes_)); + } bool MatchType(const std::string&) const; bool IsBlocked(const GURL&) const; // Access to individual entries, mostly for display/logging purposes. - const std::vector<const Entry*>& entries() const { return entries_; } + const std::vector<const Entry*>& entries() const { + return matching_entries_; + } private: Match(); void AddEntry(const Entry* entry); - std::vector<const Entry*> entries_; - unsigned int attributes_; // Precomputed ORed attributes of entries. + + std::vector<const Entry*> matching_entries_; + std::vector<const Entry*> exception_entries_; + + // Precomputed ORed attributes of matching/exception entries. + unsigned int matching_attributes_; + unsigned int exception_attributes_; friend class Blacklist; // Only blacklist constructs and sets these. }; |