| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_H_ | 5 #ifndef CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_H_ |
| 6 #define CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_H_ | 6 #define CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 explicit Blacklist(const FilePath& path); | 151 explicit Blacklist(const FilePath& path); |
| 152 | 152 |
| 153 // Destructor. | 153 // Destructor. |
| 154 ~Blacklist(); | 154 ~Blacklist(); |
| 155 | 155 |
| 156 // Returns a pointer to a Match structure holding all matching entries. | 156 // Returns a pointer to a Match structure holding all matching entries. |
| 157 // If no matching Entry is found, returns null. Ownership belongs to the | 157 // If no matching Entry is found, returns null. Ownership belongs to the |
| 158 // caller. | 158 // caller. |
| 159 Match* findMatch(const GURL&) const; | 159 Match* findMatch(const GURL&) const; |
| 160 | 160 |
| 161 // Returns true if the blacklist object is in good health. |
| 162 bool is_good() const { return is_good_; } |
| 163 |
| 161 // Helper to remove cookies from a header. | 164 // Helper to remove cookies from a header. |
| 162 static std::string StripCookies(const std::string&); | 165 static std::string StripCookies(const std::string&); |
| 163 | 166 |
| 164 // Helper to remove cookie expiration from a header. | 167 // Helper to remove cookie expiration from a header. |
| 165 static std::string StripCookieExpiry(const std::string&); | 168 static std::string StripCookieExpiry(const std::string&); |
| 166 | 169 |
| 167 private: | 170 private: |
| 168 // Matches a pattern to a core URL which is host/path with all the other | 171 // Matches a pattern to a core URL which is host/path with all the other |
| 169 // optional parts (scheme, user, password, port) stripped away. Used only | 172 // optional parts (scheme, user, password, port) stripped away. Used only |
| 170 // internally but made static so that access can be given to tests. | 173 // internally but made static so that access can be given to tests. |
| 171 static bool Matches(const std::string& pattern, const std::string& url); | 174 static bool Matches(const std::string& pattern, const std::string& url); |
| 172 | 175 |
| 173 std::vector<Entry*> blacklist_; | 176 std::vector<Entry*> blacklist_; |
| 174 std::vector<Provider*> providers_; | 177 std::vector<Provider*> providers_; |
| 175 | 178 |
| 179 bool is_good_; // True if the blacklist was read successfully. |
| 180 |
| 176 FRIEND_TEST(BlacklistTest, Generic); | 181 FRIEND_TEST(BlacklistTest, Generic); |
| 177 FRIEND_TEST(BlacklistTest, PatternMatch); | 182 FRIEND_TEST(BlacklistTest, PatternMatch); |
| 178 DISALLOW_COPY_AND_ASSIGN(Blacklist); | 183 DISALLOW_COPY_AND_ASSIGN(Blacklist); |
| 179 }; | 184 }; |
| 180 | 185 |
| 181 #endif // CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_H_ | 186 #endif // CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_H_ |
| OLD | NEW |