Chromium Code Reviews| 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 c2d26b77d5fa1249cfcf5d72c3c8fd641b00e66c..0828723bed55f29cfb7aa25a478adcce35f80f27 100644 |
| --- a/components/offline_pages/background/request_coordinator.h |
| +++ b/components/offline_pages/background/request_coordinator.h |
| @@ -18,6 +18,7 @@ |
| #include "base/time/time.h" |
| #include "base/timer/timer.h" |
| #include "components/keyed_service/core/keyed_service.h" |
| +#include "components/offline_pages/background/connection_notifier.h" |
| #include "components/offline_pages/background/device_conditions.h" |
| #include "components/offline_pages/background/offliner.h" |
| #include "components/offline_pages/background/request_coordinator_event_logger.h" |
| @@ -255,6 +256,15 @@ class RequestCoordinator : public KeyedService, |
| OfflinerImmediateStartStatus TryImmediateStart(); |
| + // Requests a callback upon the next network connection to start processing. |
| + void RequestConnectedEventForStarting(); |
| + |
| + // Clears the request for connected event if it was set. |
| + void ClearConnectedEventRequest(); |
| + |
| + // Handles receiving a connection event. Will start immediate processing. |
| + void HandleConnectedEventForStarting(); |
| + |
| // Check the request queue, and schedule a task corresponding |
| // to the least restrictive type of request in the queue. |
| void ScheduleAsNeeded(); |
| @@ -342,6 +352,8 @@ class RequestCoordinator : public KeyedService, |
| net::NetworkChangeNotifier::ConnectionType connection) { |
| use_test_connection_type_ = true; |
| test_connection_type_ = connection; |
| + if (connection_notifier_) |
|
Pete Williamson
2016/12/02 01:42:57
Why add this? It will fire an event, right? In t
dougarnett
2016/12/02 02:24:54
Yes, I want to be able to fire an event if there i
dougarnett
2016/12/02 19:08:46
Added separate method in test class
|
| + connection_notifier_->OnConnectionTypeChanged(connection); |
| } |
| void SetDeviceConditionsForTest(const DeviceConditions& current_conditions) { |
| @@ -404,6 +416,8 @@ class RequestCoordinator : public KeyedService, |
| base::OneShotTimer watchdog_timer_; |
| // Callback invoked when an immediate request is done (default empty). |
| base::Callback<void(bool)> immediate_schedule_callback_; |
| + // Used for potential immediate processing when we get network connection. |
| + std::unique_ptr<ConnectionNotifier> connection_notifier_; |
| // Allows us to pass a weak pointer to callbacks. |
| base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |