summaryrefslogtreecommitdiffstats
path: root/components/offline_pages/offline_page_metadata_store.h
diff options
context:
space:
mode:
authorfgorski <fgorski@chromium.org>2015-06-10 00:45:04 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-10 07:45:46 +0000
commit2475986c9476407f0cec00d2eb660b480db30aae (patch)
tree57c2e3ed3eb08b44302eafa6952142196bef3ee6 /components/offline_pages/offline_page_metadata_store.h
parent4d0ac15c70965c05e6905e5bf144cd8decf768c7 (diff)
downloadchromium_src-2475986c9476407f0cec00d2eb660b480db30aae.zip
chromium_src-2475986c9476407f0cec00d2eb660b480db30aae.tar.gz
chromium_src-2475986c9476407f0cec00d2eb660b480db30aae.tar.bz2
[Offline] Creates metadata store interface for offline pages
Offline pages metadata store: * Creates interface for the store * The following actions are available on the store: - AddOfflinePage, - RemoveOfflinePage, - Load, * Updates to the components_unittests to include offline pages BUG=491352 Review URL: https://codereview.chromium.org/1160283003 Cr-Commit-Position: refs/heads/master@{#333697}
Diffstat (limited to 'components/offline_pages/offline_page_metadata_store.h')
-rw-r--r--components/offline_pages/offline_page_metadata_store.h48
1 files changed, 48 insertions, 0 deletions
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 0000000..6d5cc07
--- /dev/null
+++ b/components/offline_pages/offline_page_metadata_store.h
@@ -0,0 +1,48 @@
+// 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.
+// Ability to create multiple instances of the store as well as behavior of
+// asynchronous operations when the object is being destroyed, before such
+// operation finishes will depend on implementation. It should be possbile to
+// issue multiple asynchronous operations in parallel.
+class OfflinePageMetadataStore {
+ public:
+ typedef base::Callback<void(bool, const std::vector<OfflinePageItem>&)>
+ LoadCallback;
+ typedef base::Callback<void(bool)> UpdateCallback;
+
+ OfflinePageMetadataStore();
+ virtual ~OfflinePageMetadataStore();
+
+ // Get all of the offline pages from the store.
+ virtual void Load(const LoadCallback& callback) = 0;
+
+ // Asynchronously 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;
+
+ // Asynchronously 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;
+};
+
+} // namespace offline_pages
+
+#endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_