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

Unified Diff: components/offline_pages/background/request_queue_store.h

Issue 2356433004: [Offline pages] Extracting AddRequest method in RequestQueueStore (Closed)
Patch Set: Updating the callback for AddRequest. 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/background/request_queue_store.h
diff --git a/components/offline_pages/background/request_queue_store.h b/components/offline_pages/background/request_queue_store.h
index f430b1036478233c0dce28fb728469ad0cf9936f..8ab21288e0d8d1488938115d7aba45105e3ed035 100644
--- a/components/offline_pages/background/request_queue_store.h
+++ b/components/offline_pages/background/request_queue_store.h
@@ -11,7 +11,7 @@
#include "base/callback.h"
#include "components/offline_pages/background/request_queue.h"
#include "components/offline_pages/background/save_page_request.h"
-#include "components/offline_pages/offline_page_item.h"
+#include "components/offline_pages/offline_page_types.h"
namespace offline_pages {
@@ -28,6 +28,7 @@ class RequestQueueStore {
bool /* success */,
std::vector<std::unique_ptr<SavePageRequest>> /* requests */)>
GetRequestsCallback;
+ typedef base::Callback<void(ItemActionStatus)> AddCallback;
typedef base::Callback<void(UpdateStatus)> UpdateCallback;
Pete Williamson 2016/09/21 00:00:07 Does it make sense to use the same Status type for
fgorski 2016/09/21 05:07:50 Yes, and it will use the bulk object and deliver s
typedef base::Callback<void(
const RequestQueue::UpdateMultipleRequestResults& /* statuses*/,
@@ -44,6 +45,11 @@ class RequestQueueStore {
// Gets all of the requests from the store.
virtual void GetRequests(const GetRequestsCallback& callback) = 0;
+ // Asynchronously adds request in store. Fails if request with the same
+ // offline ID already exists.
+ virtual void AddRequest(const SavePageRequest& offline_page,
+ const AddCallback& callback) = 0;
+
// Asynchronously adds or updates request in store.
// Result of the update is passed in the callback.
virtual void AddOrUpdateRequest(const SavePageRequest& request,

Powered by Google App Engine
This is Rietveld 408576698