1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_
10 #include "base/callback.h"
14 namespace offline_pages
{
16 struct OfflinePageItem
;
18 // OfflinePageMetadataStore keeps metadata for the offline pages.
19 // Ability to create multiple instances of the store as well as behavior of
20 // asynchronous operations when the object is being destroyed, before such
21 // operation finishes will depend on implementation. It should be possible to
22 // issue multiple asynchronous operations in parallel.
23 class OfflinePageMetadataStore
{
25 typedef base::Callback
<void(bool, const std::vector
<OfflinePageItem
>&)>
27 typedef base::Callback
<void(bool)> UpdateCallback
;
29 OfflinePageMetadataStore();
30 virtual ~OfflinePageMetadataStore();
32 // Get all of the offline pages from the store.
33 virtual void Load(const LoadCallback
& callback
) = 0;
35 // Asynchronously adds offline page metadata to the store for a given URL.
36 // Result of the update is passed in callback.
37 virtual void AddOfflinePage(const OfflinePageItem
& offline_page
,
38 const UpdateCallback
& callback
) = 0;
40 // Asynchronously removes offline page metadata from the store.
41 // Result of the update is passed in callback.
42 virtual void RemoveOfflinePage(const GURL
& page_url
,
43 const UpdateCallback
& callback
) = 0;
46 } // namespace offline_pages
48 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_