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

Unified Diff: components/offline_pages/offline_page_model.h

Issue 1174803002: [Offline] Adding archiver interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@offline-pages-store
Patch Set: Created 5 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/offline_pages/offline_page_model.h
diff --git a/components/offline_pages/offline_page_model.h b/components/offline_pages/offline_page_model.h
index d32ace14f36ed5216c48131660a1f257f994c2f6..52d74e9a86fa1678dfe739e5a8fe22f0b3b1f771 100644
--- a/components/offline_pages/offline_page_model.h
+++ b/components/offline_pages/offline_page_model.h
@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "components/offline_pages/offline_page_archiver.h"
class GURL;
@@ -20,14 +21,22 @@ class OfflinePageMetadataStore;
// Serivce for saving pages offline, storing the offline copy and metadata, and
// retrieving them upon request.
-class OfflinePageModel : public KeyedService {
+class OfflinePageModel : public KeyedService,
+ public OfflinePageArchiver::Client {
public:
- explicit OfflinePageModel(scoped_ptr<OfflinePageMetadataStore> store);
+ OfflinePageModel(scoped_ptr<OfflinePageMetadataStore> store,
+ OfflinePageArchiver* archiver);
~OfflinePageModel() override;
- // KeyedService:
+ // KeyedService implementation.
void Shutdown() override;
+ // OfflinePageArchiver::Client implementation.
+ void OnCreateArchiveSuccess(const OfflinePageArchiver::Request& request,
+ const base::FilePath& file_path) override;
+ void OnCreateArchiveFailure(
+ const OfflinePageArchiver::Request& request) override;
+
// Saves the page loaded in the web contents offline.
void SavePageOffline(const GURL& url);
@@ -41,6 +50,9 @@ class OfflinePageModel : public KeyedService {
// Persistent store for offline page metadata.
scoped_ptr<OfflinePageMetadataStore> store_;
+ // Offline page archiver. Outlives the model. Owned by the embedder.
+ OfflinePageArchiver* archiver_;
+
DISALLOW_COPY_AND_ASSIGN(OfflinePageModel);
};

Powered by Google App Engine
This is Rietveld 408576698