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

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

Issue 1969463002: Add a save page request to the request queue (and test it). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove files added in error. Created 4 years, 7 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_coordinator.h
diff --git a/components/offline_pages/background/request_coordinator.h b/components/offline_pages/background/request_coordinator.h
index c5dee91e55823f3af3e6948094f24d5fb8aee1df..3c3d6b2476777be3ecb4d3c6277d8a003a6f8c11 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -10,6 +10,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "components/keyed_service/core/keyed_service.h"
+#include "components/offline_pages/background/request_queue.h"
#include "url/gurl.h"
namespace offline_pages {
@@ -18,6 +19,7 @@ struct ClientId;
class OfflinerPolicy;
class OfflinerFactory;
class Offliner;
+class RequestQueue;
fgorski 2016/05/10 21:18:12 since you are adding the header above, you don't n
Pete Williamson 2016/05/10 22:51:57 Done.
class SavePageRequest;
// Coordinates queueing and processing save page later requests.
@@ -27,7 +29,8 @@ class RequestCoordinator : public KeyedService {
typedef base::Callback<void()> ProcessingDoneCallback;
RequestCoordinator(std::unique_ptr<OfflinerPolicy> policy,
- std::unique_ptr<OfflinerFactory> factory);
+ std::unique_ptr<OfflinerFactory> factory,
+ std::unique_ptr<RequestQueue> queue);
~RequestCoordinator() override;
@@ -46,11 +49,18 @@ class RequestCoordinator : public KeyedService {
// is stopped or complete.
void StopProcessing();
+ // Returns the request queue used for requests. Coordinator keeps ownership.
+ RequestQueue* GetQueue() { return queue_.get(); }
+
private:
+ void AddRequestResultCallback(RequestQueue::AddRequestResult result,
+ const SavePageRequest& request);
// RequestCoordinator takes over ownership of the policy
std::unique_ptr<OfflinerPolicy> policy_;
// Factory is owned by the RequestCoordinator.
std::unique_ptr<OfflinerFactory> factory_;
+ // The queue is also owned by this RequestCoordinator.
dougarnett 2016/05/10 20:23:34 nit - unless I'm missing something, seems like all
Pete Williamson 2016/05/10 21:07:45 Sure. I was trying to avoid boring the reader by
fgorski 2016/05/10 21:18:12 Good point. I suggest: // Request queue. Used to <
Pete Williamson 2016/05/10 22:51:57 Done.
+ std::unique_ptr<RequestQueue> queue_;
DISALLOW_COPY_AND_ASSIGN(RequestCoordinator);
};

Powered by Google App Engine
This is Rietveld 408576698