| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 bool StartProcessing(const DeviceConditions& device_conditions, | 52 bool StartProcessing(const DeviceConditions& device_conditions, |
| 53 const base::Callback<void(bool)>& callback); | 53 const base::Callback<void(bool)>& callback); |
| 54 | 54 |
| 55 // Stops the current request processing if active. This is a way for | 55 // Stops the current request processing if active. This is a way for |
| 56 // caller to abort processing; otherwise, processing will complete on | 56 // caller to abort processing; otherwise, processing will complete on |
| 57 // its own. In either case, the callback will be called when processing | 57 // its own. In either case, the callback will be called when processing |
| 58 // is stopped or complete. | 58 // is stopped or complete. |
| 59 void StopProcessing(); | 59 void StopProcessing(); |
| 60 | 60 |
| 61 // TODO(dougarnett): Move to OfflinerPolicy in some form. | 61 // TODO(dougarnett): Move to OfflinerPolicy in some form. |
| 62 Scheduler::TriggerConditions const& GetTriggerConditionsForUserRequest(); | 62 const Scheduler::TriggerConditions& GetTriggerConditionsForUserRequest(); |
| 63 | 63 |
| 64 // A way for tests to set the callback in use when an operation is over. | 64 // A way for tests to set the callback in use when an operation is over. |
| 65 void SetProcessingCallbackForTest(const base::Callback<void(bool)> callback) { | 65 void SetProcessingCallbackForTest(const base::Callback<void(bool)> callback) { |
| 66 scheduler_callback_ = callback; | 66 scheduler_callback_ = callback; |
| 67 } | 67 } |
| 68 | 68 |
| 69 // Returns the request queue used for requests. Coordinator keeps ownership. | 69 // Returns the request queue used for requests. Coordinator keeps ownership. |
| 70 RequestQueue* queue() { return queue_.get(); } | 70 RequestQueue* queue() { return queue_.get(); } |
| 71 | 71 |
| 72 // Return an unowned pointer to the Scheduler. | 72 // Return an unowned pointer to the Scheduler. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 base::Callback<void(bool)> scheduler_callback_; | 138 base::Callback<void(bool)> scheduler_callback_; |
| 139 // Allows us to pass a weak pointer to callbacks. | 139 // Allows us to pass a weak pointer to callbacks. |
| 140 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 140 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
| 141 | 141 |
| 142 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 142 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 } // namespace offline_pages | 145 } // namespace offline_pages |
| 146 | 146 |
| 147 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 147 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |