Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 // Current store state. When LOADED, the store is operational. When | |
| 40 // initialization or reset fails, it is reflected appropriately. | |
| 41 enum StoreState { | |
| 42 NOT_LOADED, | |
| 43 LOADED, | |
| 44 FAILED_INITIALIZATION, | |
|
Dmitry Titov
2016/09/12 18:05:29
These 2 'state' enums (LoadStatus and StoreState)
fgorski
2016/09/12 21:07:42
TODO added. You are correct and this enum is meant
| |
| 45 FAILED_RESET, | |
| 46 }; | |
| 47 | |
| 39 typedef base::Callback<void(LoadStatus, const std::vector<OfflinePageItem>&)> | 48 typedef base::Callback<void(LoadStatus, const std::vector<OfflinePageItem>&)> |
| 40 LoadCallback; | 49 LoadCallback; |
| 41 typedef base::Callback<void(bool)> UpdateCallback; | 50 typedef base::Callback<void(bool)> UpdateCallback; |
| 42 typedef base::Callback<void(bool)> ResetCallback; | 51 typedef base::Callback<void(bool)> ResetCallback; |
| 43 | 52 |
| 44 OfflinePageMetadataStore(); | 53 OfflinePageMetadataStore(); |
| 45 virtual ~OfflinePageMetadataStore(); | 54 virtual ~OfflinePageMetadataStore(); |
| 46 | 55 |
| 47 // Get all of the offline pages from the store. | 56 // Get all of the offline pages from the store. |
| 48 virtual void Load(const LoadCallback& callback) = 0; | 57 virtual void GetOfflinePages(const LoadCallback& callback) = 0; |
| 49 | 58 |
| 50 // Asynchronously adds or updates offline page metadata to the store. | 59 // Asynchronously adds or updates offline page metadata to the store. |
| 51 // Result of the update is passed in callback. | 60 // Result of the update is passed in callback. |
| 52 virtual void AddOrUpdateOfflinePage(const OfflinePageItem& offline_page, | 61 virtual void AddOrUpdateOfflinePage(const OfflinePageItem& offline_page, |
| 53 const UpdateCallback& callback) = 0; | 62 const UpdateCallback& callback) = 0; |
| 54 | 63 |
| 55 // Asynchronously removes offline page metadata from the store. | 64 // Asynchronously removes offline page metadata from the store. |
| 56 // Result of the update is passed in callback. | 65 // Result of the update is passed in callback. |
| 57 virtual void RemoveOfflinePages(const std::vector<int64_t>& offline_ids, | 66 virtual void RemoveOfflinePages(const std::vector<int64_t>& offline_ids, |
| 58 const UpdateCallback& callback) = 0; | 67 const UpdateCallback& callback) = 0; |
| 59 | 68 |
| 60 // Resets the store. | 69 // Resets the store. |
| 61 virtual void Reset(const ResetCallback& callback) = 0; | 70 virtual void Reset(const ResetCallback& callback) = 0; |
| 71 | |
| 72 // Gets the store state. | |
| 73 virtual StoreState state() const = 0; | |
| 62 }; | 74 }; |
| 63 | 75 |
| 64 } // namespace offline_pages | 76 } // namespace offline_pages |
| 65 | 77 |
| 66 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ | 78 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ |
| OLD | NEW |