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

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

Issue 2489443002: Move all components/offline_pages/ files into component/offline_pages/core (Closed)
Patch Set: update Created 4 years, 1 month 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 <stdint.h>
9
10 #include <vector>
11
12 #include "base/callback.h"
13 #include "components/offline_pages/offline_page_item.h"
14 #include "components/offline_pages/offline_store_types.h"
15
16 class GURL;
17
18 namespace offline_pages {
19
20 typedef StoreUpdateResult<OfflinePageItem> OfflinePagesUpdateResult;
21
22 // OfflinePageMetadataStore keeps metadata for the offline pages.
23 // Ability to create multiple instances of the store as well as behavior of
24 // asynchronous operations when the object is being destroyed, before such
25 // operation finishes will depend on implementation. It should be possible to
26 // issue multiple asynchronous operations in parallel.
27 class OfflinePageMetadataStore {
28 public:
29 // This enum is used in an UMA histogram. Hence the entries here shouldn't
30 // be deleted or re-ordered and new ones should be added to the end.
31 enum LoadStatus {
32 LOAD_SUCCEEDED,
33 STORE_INIT_FAILED,
34 STORE_LOAD_FAILED,
35 DATA_PARSING_FAILED,
36
37 // NOTE: always keep this entry at the end.
38 LOAD_STATUS_COUNT
39 };
40
41 typedef base::Callback<void(LoadStatus, const std::vector<OfflinePageItem>&)>
42 LoadCallback;
43 typedef base::Callback<void(ItemActionStatus)> AddCallback;
44 typedef base::Callback<void(std::unique_ptr<OfflinePagesUpdateResult>)>
45 UpdateCallback;
46 typedef base::Callback<void(bool)> ResetCallback;
47
48 OfflinePageMetadataStore();
49 virtual ~OfflinePageMetadataStore();
50
51 // Get all of the offline pages from the store.
52 virtual void GetOfflinePages(const LoadCallback& callback) = 0;
53
54 // Asynchronously adds an offline page item metadata to the store.
55 virtual void AddOfflinePage(const OfflinePageItem& offline_page,
56 const AddCallback& callback) = 0;
57
58 // Asynchronously updates a set of offline page items in the store.
59 virtual void UpdateOfflinePages(const std::vector<OfflinePageItem>& pages,
60 const UpdateCallback& callback) = 0;
61
62 // Asynchronously removes offline page metadata from the store.
63 // Result of the update is passed in callback.
64 virtual void RemoveOfflinePages(const std::vector<int64_t>& offline_ids,
65 const UpdateCallback& callback) = 0;
66
67 // Resets the store.
68 virtual void Reset(const ResetCallback& callback) = 0;
69
70 // Gets the store state.
71 virtual StoreState state() const = 0;
72 };
73
74 } // namespace offline_pages
75
76 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698