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

Unified Diff: chrome/browser/privacy_blacklist/blacklist_io.h

Issue 337025: Design changes in browser/privacy_blacklist needed to integrate (Closed)
Patch Set: fixes Created 11 years, 2 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 | « chrome/browser/privacy_blacklist/blacklist.cc ('k') | chrome/browser/privacy_blacklist/blacklist_io.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/privacy_blacklist/blacklist_io.h
diff --git a/chrome/browser/privacy_blacklist/blacklist_io.h b/chrome/browser/privacy_blacklist/blacklist_io.h
index bbcf0650c24f1be08eb9610dac3fc7e0cd8c109e..2fac21dff6a3d4da8963b014af8683597b4efd8d 100644
--- a/chrome/browser/privacy_blacklist/blacklist_io.h
+++ b/chrome/browser/privacy_blacklist/blacklist_io.h
@@ -5,48 +5,25 @@
#ifndef CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_IO_H_
#define CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_IO_H_
-#include <list>
-
-#include "base/string16.h"
-#include "chrome/browser/privacy_blacklist/blacklist.h"
+#include <string>
+class Blacklist;
class FilePath;
-// Helper class to keep state while reading multiple text blacklists to
-// produce a single binary blacklist used by the Blacklist constructor.
+// Set of routines to read and write blacklists.
class BlacklistIO {
public:
- BlacklistIO();
- ~BlacklistIO();
-
- // Reads a text blacklist, as downloaded from the blacklist provider.
- bool Read(const FilePath& path);
-
- // Writes a binary blacklist with aggregated entries for all read blacklists.
- bool Write(const FilePath& path);
-
- // Returns the text of the last occuring error. An empty string is returned
- // if no such error happened.
- const string16& last_error() const {
- return last_error_;
- }
-
- private:
- // Introspection functions, for testing purposes.
- const std::list<Blacklist::Entry*>& blacklist() const {
- return blacklist_;
- }
- const std::list<Blacklist::Provider*>& providers() const {
- return providers_;
- }
-
- std::list<Blacklist::Entry*> blacklist_;
- std::list<Blacklist::Provider*> providers_;
- string16 last_error_; // Stores text of last error, empty if N/A.
-
- FRIEND_TEST(BlacklistIOTest, Generic);
- FRIEND_TEST(BlacklistIOTest, Combine);
- DISALLOW_COPY_AND_ASSIGN(BlacklistIO);
+ // Reads a blacklist stored on disk in a text format.
+ // On error returns false and fills |error_string|.
+ static bool ReadText(Blacklist* blacklist, const FilePath& path,
+ std::string* error_string);
+
+ // Reads a blacklist stored on disk in a binary format.
+ // Returns true on success.
+ static bool ReadBinary(Blacklist* blacklist, const FilePath& path);
+
+ // Writes |blacklist| to |path| in a binary format. Returns true on success.
+ static bool WriteBinary(const Blacklist* blacklist, const FilePath& path);
};
#endif // CHROME_BROWSER_PRIVACY_BLACKLIST_BLACKLIST_IO_H_
« no previous file with comments | « chrome/browser/privacy_blacklist/blacklist.cc ('k') | chrome/browser/privacy_blacklist/blacklist_io.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698