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 47991061dba95200a826cfac6abb9289ce0d0736..fdbe868a0fcf2fda0af468dc930564cfbacf2b1d 100644 |
--- a/components/offline_pages/background/request_coordinator.h |
+++ b/components/offline_pages/background/request_coordinator.h |
@@ -6,11 +6,16 @@ |
#define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
#include "base/callback.h" |
+#include "components/keyed_service/core/keyed_service.h" |
namespace offline_pages { |
+class OfflinerPolicy; |
+class OfflinerFactory; |
+class Offliner; |
+ |
// 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; |
@@ -19,10 +24,7 @@ class RequestCoordinator { |
// TODO(dougarnett): define and consider making stand-alone. |
}; |
- // TODO(dougarnett): How to inject Offliner factories and policy objects. |
- RequestCoordinator(); |
- |
- ~RequestCoordinator(); |
+ ~RequestCoordinator() override; |
// Queues |request| to later load and save when system conditions allow. |
bool SavePageLater(const SavePageRequest& request); |
@@ -38,7 +40,16 @@ class RequestCoordinator { |
// is stopped or complete. |
void StopProcessing(); |
- // TODO(dougarnett): add policy support methods. |
+ // Factory has permission to call our private constructor. |
+ friend class RequestCoordinatorFactory; |
fgorski
2016/05/03 22:48:16
I don't think you need this.
Constructor can be pu
Pete Williamson
2016/05/04 00:39:22
Removed. I'm happy without it, but I thought I re
|
+ |
+ private: |
+ RequestCoordinator( |
+ OfflinerPolicy* policy, OfflinerFactory* factory); |
+ |
+ OfflinerPolicy* policy_; |
fgorski
2016/05/03 22:48:16
this should be a unique_ptr.
Pete Williamson
2016/05/04 00:39:21
Can I use a unique ptr if I am going to pass a poi
fgorski
2016/05/04 05:20:57
Here is how I see this:
1. RC owns the policy (uni
Pete Williamson
2016/05/04 21:23:21
Done.
|
+ OfflinerFactory* factory_; |
fgorski
2016/05/03 22:48:17
who controls the life of a factory?
Pete Williamson
2016/05/04 00:39:22
The request coordinator should control the lifetim
fgorski
2016/05/04 05:20:57
unique_ptr then? per response above.
Pete Williamson
2016/05/04 21:23:21
Done.
|
+ int factoryArraySize_; |
fgorski
2016/05/03 22:48:17
?
Pete Williamson
2016/05/04 00:39:22
Oops, leftover. Removed.
|
}; |
} // namespace offline_pages |