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

Unified Diff: components/safe_browsing_db/v4_store.h

Issue 2062013002: Fetch incremental updates. Store new state in V4Store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git fetch && git pull Created 4 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
Index: components/safe_browsing_db/v4_store.h
diff --git a/components/safe_browsing_db/v4_store.h b/components/safe_browsing_db/v4_store.h
index 7be3f72f20a158cf89973db533b9c89dffb5a2a9..2d83f393c04a900828f79474ebc398db1a8b1790 100644
--- a/components/safe_browsing_db/v4_store.h
+++ b/components/safe_browsing_db/v4_store.h
@@ -8,11 +8,16 @@
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h"
+#include "base/single_thread_task_runner.h"
+#include "components/safe_browsing_db/v4_protocol_manager_util.h"
namespace safe_browsing {
class V4Store;
+typedef base::Callback<void(std::unique_ptr<V4Store>)>
+ UpdatedStoreReadyCallback;
+
// Factory for creating V4Store. Tests implement this factory to create fake
// stores for testing.
class V4StoreFactory {
@@ -32,20 +37,29 @@ class V4Store {
const base::FilePath& store_path);
virtual ~V4Store();
+ const std::string& state() const { return state_; }
+
+ const base::FilePath& store_path() const { return store_path_; }
+
+ void ApplyUpdate(const ListUpdateResponse&,
+ const scoped_refptr<base::SingleThreadTaskRunner>&,
+ UpdatedStoreReadyCallback);
+
+ std::string DebugString() const;
+
// Reset internal state and delete the backing file.
virtual bool Reset();
- const base::FilePath& store_path() const {
- return store_path_;
- }
-
- protected:
- const scoped_refptr<base::SequencedTaskRunner> task_runner_;
+ private:
+ // The state of the store as returned by the PVer4 server in the last applied
+ // update response.
+ std::string state_;
const base::FilePath store_path_;
-
- DISALLOW_COPY_AND_ASSIGN(V4Store);
+ const scoped_refptr<base::SequencedTaskRunner> task_runner_;
};
+std::ostream& operator<<(std::ostream& os, const V4Store& store);
+
} // namespace safe_browsing
#endif // COMPONENTS_SAFE_BROWSING_DB_V4_STORE_H_

Powered by Google App Engine
This is Rietveld 408576698