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

Unified Diff: components/offline_pages/offline_page_metadata_store_impl.h

Issue 1420003004: Wipe out offline page data on clearing cookie and site data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests Created 5 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
Index: components/offline_pages/offline_page_metadata_store_impl.h
diff --git a/components/offline_pages/offline_page_metadata_store_impl.h b/components/offline_pages/offline_page_metadata_store_impl.h
index 3bab989ec4d1730d4e4e511ddf722023f0affded..45f7a91e1cf8ea4c893ced62382a5b31031dfa5f 100644
--- a/components/offline_pages/offline_page_metadata_store_impl.h
+++ b/components/offline_pages/offline_page_metadata_store_impl.h
@@ -7,13 +7,14 @@
#include <vector>
+#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "components/leveldb_proto/proto_database.h"
#include "components/offline_pages/offline_page_metadata_store.h"
namespace base {
-class FilePath;
+class SequencedTaskRunner;
}
namespace offline_pages {
@@ -29,7 +30,7 @@ class OfflinePageEntry;
class OfflinePageMetadataStoreImpl : public OfflinePageMetadataStore {
public:
OfflinePageMetadataStoreImpl(
- scoped_ptr<leveldb_proto::ProtoDatabase<OfflinePageEntry>> database,
+ scoped_refptr<base::SequencedTaskRunner> background_task_runner,
const base::FilePath& database_dir);
~OfflinePageMetadataStoreImpl() override;
@@ -39,10 +40,13 @@ class OfflinePageMetadataStoreImpl : public OfflinePageMetadataStore {
const UpdateCallback& callback) override;
void RemoveOfflinePages(const std::vector<int64>& bookmark_ids,
const UpdateCallback& callback) override;
+ void Reset(const ResetCallback& callback) override;
private:
- // Callback for when initialization of the |database_| is done.
- void OnInitDone(bool success);
+ void LoadContinuation(const LoadCallback& callback, bool success);
+ void LoadCompleted(const LoadCallback& callback,
+ bool success,
+ scoped_ptr<std::vector<OfflinePageEntry>> entries);
// Implements the update.
void UpdateEntries(
@@ -50,11 +54,14 @@ class OfflinePageMetadataStoreImpl : public OfflinePageMetadataStore {
entries_to_save,
scoped_ptr<std::vector<std::string>> keys_to_remove,
const UpdateCallback& callback);
+ void UpdateCompleted(
+ const OfflinePageMetadataStore::UpdateCallback& callback,
+ bool success);
- // Resets the database. This is to be used when one of the operations fails
- // with no good explanation.
- void ResetDB();
+ void ResetCompleted(const ResetCallback& callback, bool success);
+ scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
+ base::FilePath database_dir_;
scoped_ptr<leveldb_proto::ProtoDatabase<OfflinePageEntry>> database_;
base::WeakPtrFactory<OfflinePageMetadataStoreImpl> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698