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

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

Issue 1929223002: Add skeletons for the factories to create the request coordinator and (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Attempt gypi file fix. 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 b25bf4bbf78887d099d7d5f87f272e208d4a15b8..56fa96e67d66f803cf469e5fd08595800f45c11a 100644
--- a/components/offline_pages/background/request_coordinator.h
+++ b/components/offline_pages/background/request_coordinator.h
@@ -5,22 +5,29 @@
#ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
#define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_
+#include <memory>
+
#include "base/callback.h"
+#include "base/macros.h"
+#include "components/keyed_service/core/keyed_service.h"
namespace offline_pages {
+class OfflinerPolicy;
+class OfflinerFactory;
+class Offliner;
class SavePageRequest;
// Coordinates queueing and processing save page later requests.
-class RequestCoordinator {
+class RequestCoordinator : public KeyedService {
public:
// Callback to report when the processing of a triggered task is complete.
typedef base::Callback<void()> ProcessingDoneCallback;
- // TODO(dougarnett): How to inject Offliner factories and policy objects.
- RequestCoordinator();
+ RequestCoordinator(std::unique_ptr<OfflinerPolicy> policy,
+ std::unique_ptr<OfflinerFactory> factory);
- ~RequestCoordinator();
+ ~RequestCoordinator() override;
// Queues |request| to later load and save when system conditions allow.
// Returns true if the page could be queued successfully.
@@ -37,7 +44,13 @@ class RequestCoordinator {
// is stopped or complete.
void StopProcessing();
- // TODO(dougarnett): add policy support methods.
+ private:
+ // RequestCoordinator takes over ownership of the policy
+ std::unique_ptr<OfflinerPolicy> policy_;
+ // Factory is owned by the RequestCoordinator.
+ std::unique_ptr<OfflinerFactory> factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(RequestCoordinator);
};
} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698