Index: components/offline_pages/offline_page_metadata_store.h |
diff --git a/components/offline_pages/offline_page_metadata_store.h b/components/offline_pages/offline_page_metadata_store.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4f13458ecf38990ad9e4d51c0c26e863f862e860 |
--- /dev/null |
+++ b/components/offline_pages/offline_page_metadata_store.h |
@@ -0,0 +1,60 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ |
+#define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ |
+ |
+#include <vector> |
+ |
+#include "base/callback.h" |
+ |
+class GURL; |
+ |
+namespace offline_pages { |
+ |
+struct OfflinePageItem; |
+ |
+// OfflinePageMetadataStore keeps metadata for the offline pages. |
+class OfflinePageMetadataStore { |
+ public: |
+ // Status of operations on the store. |
+ // TODO(fgorski): Add UMA to update status. |
+ enum Status { |
+ SUCCESS, |
+ FAILED_TO_OPEN_STORE, |
+ FAILED_TO_LOAD_STORE, |
+ FAILED_TO_DESERIALIZE, |
+ FAILED_TO_UPDATE_STORE, |
+ FAILED_TO_DESTROY_STORE, |
+ STATUS_COUNT // status count - good for initializing to none. |
+ }; |
+ |
+ typedef base::Callback<void(Status, const std::vector<OfflinePageItem>&)> |
+ LoadCallback; |
+ typedef base::Callback<void(Status)> UpdateCallback; |
+ |
+ OfflinePageMetadataStore(); |
+ virtual ~OfflinePageMetadataStore(); |
+ |
+ // Get all of the offline pages from the store. |
+ virtual void Load(const LoadCallback& callback) = 0; |
+ |
+ // Adds offline page metadata to the store for a given URL. |
+ // Result of the update is passed in callback. |
+ virtual void AddOfflinePage(const OfflinePageItem& offline_page, |
+ const UpdateCallback& callback) = 0; |
+ |
+ // Removes offline page metadata from the store. |
+ // Result of the update is passed in callback. |
+ virtual void RemoveOfflinePage(const GURL& page_url, |
+ const UpdateCallback& callback) = 0; |
+ |
+ // Destroys the offline page metadata store. |
+ // Result of the update is passed in callback. |
+ virtual void Destroy(const UpdateCallback& callback) = 0; |
+}; |
+ |
+} // namespace offline_pages |
+ |
+#endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ |