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

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

Issue 2339693002: [Offline pages] Splitting Add and Update methods in OPMStore (Closed)
Patch Set: Addressing feedback Created 4 years, 3 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
« no previous file with comments | « no previous file | components/offline_pages/offline_page_metadata_store_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 28 matching lines...) Expand all
39 // TODO(fgorski): This enum is meant to replace |LoadStatus|. 39 // TODO(fgorski): This enum is meant to replace |LoadStatus|.
40 // Current store state. When LOADED, the store is operational. When 40 // Current store state. When LOADED, the store is operational. When
41 // initialization or reset fails, it is reflected appropriately. 41 // initialization or reset fails, it is reflected appropriately.
42 enum StoreState { 42 enum StoreState {
43 NOT_LOADED, 43 NOT_LOADED,
44 LOADED, 44 LOADED,
45 FAILED_INITIALIZATION, 45 FAILED_INITIALIZATION,
46 FAILED_RESET, 46 FAILED_RESET,
47 }; 47 };
48 48
49 // Statuses referring to actions taken on items in the store.
50 enum ItemActionStatus {
51 SUCCESS,
52 ALREADY_EXISTS,
53 DOESNT_EXIST,
54 STORE_ERROR,
55 };
56
49 typedef base::Callback<void(LoadStatus, const std::vector<OfflinePageItem>&)> 57 typedef base::Callback<void(LoadStatus, const std::vector<OfflinePageItem>&)>
50 LoadCallback; 58 LoadCallback;
59 typedef base::Callback<void(ItemActionStatus)> AddCallback;
51 typedef base::Callback<void(bool)> UpdateCallback; 60 typedef base::Callback<void(bool)> UpdateCallback;
52 typedef base::Callback<void(bool)> ResetCallback; 61 typedef base::Callback<void(bool)> ResetCallback;
53 62
54 OfflinePageMetadataStore(); 63 OfflinePageMetadataStore();
55 virtual ~OfflinePageMetadataStore(); 64 virtual ~OfflinePageMetadataStore();
56 65
57 // Get all of the offline pages from the store. 66 // Get all of the offline pages from the store.
58 virtual void GetOfflinePages(const LoadCallback& callback) = 0; 67 virtual void GetOfflinePages(const LoadCallback& callback) = 0;
59 68
60 // Asynchronously adds or updates offline page metadata to the store. 69 // Asynchronously adds an offline page item metadata to the store.
61 // Result of the update is passed in callback. 70 virtual void AddOfflinePage(const OfflinePageItem& offline_page,
62 virtual void AddOrUpdateOfflinePage(const OfflinePageItem& offline_page, 71 const AddCallback& callback) = 0;
63 const UpdateCallback& callback) = 0; 72
73 // Asynchronously updates a set of offline page items in the store.
74 virtual void UpdateOfflinePages(const std::vector<OfflinePageItem>& pages,
75 const UpdateCallback& callback) = 0;
64 76
65 // Asynchronously removes offline page metadata from the store. 77 // Asynchronously removes offline page metadata from the store.
66 // Result of the update is passed in callback. 78 // Result of the update is passed in callback.
67 virtual void RemoveOfflinePages(const std::vector<int64_t>& offline_ids, 79 virtual void RemoveOfflinePages(const std::vector<int64_t>& offline_ids,
68 const UpdateCallback& callback) = 0; 80 const UpdateCallback& callback) = 0;
69 81
70 // Resets the store. 82 // Resets the store.
71 virtual void Reset(const ResetCallback& callback) = 0; 83 virtual void Reset(const ResetCallback& callback) = 0;
72 84
73 // Gets the store state. 85 // Gets the store state.
74 virtual StoreState state() const = 0; 86 virtual StoreState state() const = 0;
75 }; 87 };
76 88
77 } // namespace offline_pages 89 } // namespace offline_pages
78 90
79 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ 91 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_
OLDNEW
« no previous file with comments | « no previous file | components/offline_pages/offline_page_metadata_store_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698