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

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

Issue 2329283002: [Offline pages] OPM SQL store: moving load to constructor, updating read to GetOfflinePages (Closed)
Patch Set: Addressing CR 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 18 matching lines...) Expand all
29 enum LoadStatus { 29 enum LoadStatus {
30 LOAD_SUCCEEDED, 30 LOAD_SUCCEEDED,
31 STORE_INIT_FAILED, 31 STORE_INIT_FAILED,
32 STORE_LOAD_FAILED, 32 STORE_LOAD_FAILED,
33 DATA_PARSING_FAILED, 33 DATA_PARSING_FAILED,
34 34
35 // NOTE: always keep this entry at the end. 35 // NOTE: always keep this entry at the end.
36 LOAD_STATUS_COUNT 36 LOAD_STATUS_COUNT
37 }; 37 };
38 38
39 // TODO(fgorski): This enum is meant to replace |LoadStatus|.
40 // Current store state. When LOADED, the store is operational. When
41 // initialization or reset fails, it is reflected appropriately.
42 enum StoreState {
43 NOT_LOADED,
44 LOADED,
45 FAILED_INITIALIZATION,
46 FAILED_RESET,
47 };
48
39 typedef base::Callback<void(LoadStatus, const std::vector<OfflinePageItem>&)> 49 typedef base::Callback<void(LoadStatus, const std::vector<OfflinePageItem>&)>
40 LoadCallback; 50 LoadCallback;
41 typedef base::Callback<void(bool)> UpdateCallback; 51 typedef base::Callback<void(bool)> UpdateCallback;
42 typedef base::Callback<void(bool)> ResetCallback; 52 typedef base::Callback<void(bool)> ResetCallback;
43 53
44 OfflinePageMetadataStore(); 54 OfflinePageMetadataStore();
45 virtual ~OfflinePageMetadataStore(); 55 virtual ~OfflinePageMetadataStore();
46 56
47 // Get all of the offline pages from the store. 57 // Get all of the offline pages from the store.
48 virtual void Load(const LoadCallback& callback) = 0; 58 virtual void GetOfflinePages(const LoadCallback& callback) = 0;
49 59
50 // Asynchronously adds or updates offline page metadata to the store. 60 // Asynchronously adds or updates offline page metadata to the store.
51 // Result of the update is passed in callback. 61 // Result of the update is passed in callback.
52 virtual void AddOrUpdateOfflinePage(const OfflinePageItem& offline_page, 62 virtual void AddOrUpdateOfflinePage(const OfflinePageItem& offline_page,
53 const UpdateCallback& callback) = 0; 63 const UpdateCallback& callback) = 0;
54 64
55 // Asynchronously removes offline page metadata from the store. 65 // Asynchronously removes offline page metadata from the store.
56 // Result of the update is passed in callback. 66 // Result of the update is passed in callback.
57 virtual void RemoveOfflinePages(const std::vector<int64_t>& offline_ids, 67 virtual void RemoveOfflinePages(const std::vector<int64_t>& offline_ids,
58 const UpdateCallback& callback) = 0; 68 const UpdateCallback& callback) = 0;
59 69
60 // Resets the store. 70 // Resets the store.
61 virtual void Reset(const ResetCallback& callback) = 0; 71 virtual void Reset(const ResetCallback& callback) = 0;
72
73 // Gets the store state.
74 virtual StoreState state() const = 0;
62 }; 75 };
63 76
64 } // namespace offline_pages 77 } // namespace offline_pages
65 78
66 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ 79 #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