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

Side by Side Diff: components/offline_pages/offline_page_metadata_store.h

Issue 1160283003: [Offline] Creates metadata store interface for offline pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@offline-pages-1
Patch Set: Adding BUILD.gn updates 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 unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_
7
8 #include <vector>
9
10 #include "base/callback.h"
11
12 class GURL;
13
14 namespace offline_pages {
15
16 struct OfflinePageItem;
17
18 // OfflinePageMetadataStore keeps metadata for the offline pages.
19 class OfflinePageMetadataStore {
20 public:
21 // Status of operations on the store.
22 // TODO(fgorski): Add UMA to update status.
23 enum Status {
24 SUCCESS,
25 FAILED_TO_OPEN_STORE,
26 FAILED_TO_LOAD_STORE,
27 FAILED_TO_DESERIALIZE,
28 FAILED_TO_UPDATE_STORE,
29 FAILED_TO_DESTROY_STORE,
30 STATUS_COUNT // status count - good for initializing to none.
31 };
32
33 typedef base::Callback<void(Status, const std::vector<OfflinePageItem>&)>
34 LoadCallback;
35 typedef base::Callback<void(Status)> UpdateCallback;
36
37 OfflinePageMetadataStore();
38 virtual ~OfflinePageMetadataStore();
39
40 // Get all of the offline pages from the store.
41 virtual void Load(const LoadCallback& callback) = 0;
42
43 // Adds offline page metadata to the store for a given URL.
44 // Result of the update is passed in callback.
45 virtual void AddOfflinePage(const OfflinePageItem& offline_page,
46 const UpdateCallback& callback) = 0;
47
48 // Removes offline page metadata from the store.
49 // Result of the update is passed in callback.
50 virtual void RemoveOfflinePage(const GURL& page_url,
51 const UpdateCallback& callback) = 0;
52
53 // Destroys the offline page metadata store.
54 // Result of the update is passed in callback.
55 virtual void Destroy(const UpdateCallback& callback) = 0;
56 };
57
58 } // namespace offline_pages
59
60 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698