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

Unified Diff: components/offline_pages/offline_page_metadata_store.h

Issue 2353393002: [Offline pages] Extracting and templatizing types for store callbacks (Closed)
Patch Set: Removing offline_store_types_impl.h 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 side-by-side diff with in-line comments
Download patch
Index: components/offline_pages/offline_page_metadata_store.h
diff --git a/components/offline_pages/offline_page_metadata_store.h b/components/offline_pages/offline_page_metadata_store.h
index 03f9873e7bd7fdf7a8713fa5b2c0fc6403457175..26314804bdce08b2df6e0ad0280aee4937a3fb73 100644
--- a/components/offline_pages/offline_page_metadata_store.h
+++ b/components/offline_pages/offline_page_metadata_store.h
@@ -11,38 +11,13 @@
#include "base/callback.h"
#include "components/offline_pages/offline_page_item.h"
-#include "components/offline_pages/offline_page_types.h"
+#include "components/offline_pages/offline_store_types.h"
class GURL;
namespace offline_pages {
-// TODO(fgorski): This enum is meant to replace |LoadStatus|.
-// Current store state. When LOADED, the store is operational. When
-// initialization or reset fails, it is reflected appropriately.
-enum class StoreState {
- NOT_LOADED, // Store is not loaded yet.
- LOADED, // Store is properly loaded and operational.
- FAILED_LOADING, // Store initialization failed.
- FAILED_RESET, // Resetting the store failed.
-};
-
-class StoreUpdateResult {
- public:
- explicit StoreUpdateResult(StoreState state);
- ~StoreUpdateResult();
-
- // List of Offline ID to item action status mappings.
- // It is meant to be consumed by the original caller of the operation.
- std::vector<std::pair<int64_t, ItemActionStatus>> item_statuses;
-
- // List of successfully updated offline page items as seen after operation
- // concludes. It is meant to be used when passing to the observers.
- std::vector<OfflinePageItem> updated_items;
-
- // State of the store after the operation is done.
- StoreState store_state;
-};
+typedef StoreUpdateResult<OfflinePageItem> OfflinePagesUpdateResult;
// OfflinePageMetadataStore keeps metadata for the offline pages.
// Ability to create multiple instances of the store as well as behavior of
@@ -66,7 +41,7 @@ class OfflinePageMetadataStore {
typedef base::Callback<void(LoadStatus, const std::vector<OfflinePageItem>&)>
LoadCallback;
typedef base::Callback<void(ItemActionStatus)> AddCallback;
- typedef base::Callback<void(std::unique_ptr<StoreUpdateResult>)>
+ typedef base::Callback<void(std::unique_ptr<OfflinePagesUpdateResult>)>
UpdateCallback;
typedef base::Callback<void(bool)> ResetCallback;
« no previous file with comments | « components/offline_pages/background/request_queue_store.h ('k') | components/offline_pages/offline_page_metadata_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698