Chromium Code Reviews| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 73 const base::Callback<void(bool)>& callback); | 73 const base::Callback<void(bool)>& callback); |
| 74 | 74 |
| 75 // Stops the current request processing if active. This is a way for | 75 // Stops the current request processing if active. This is a way for |
| 76 // caller to abort processing; otherwise, processing will complete on | 76 // caller to abort processing; otherwise, processing will complete on |
| 77 // its own. In either case, the callback will be called when processing | 77 // its own. In either case, the callback will be called when processing |
| 78 // is stopped or complete. | 78 // is stopped or complete. |
| 79 void StopProcessing(); | 79 void StopProcessing(); |
| 80 | 80 |
| 81 const Scheduler::TriggerConditions GetTriggerConditionsForUserRequest(); | 81 const Scheduler::TriggerConditions GetTriggerConditionsForUserRequest(); |
| 82 | 82 |
| 83 // Notifies the observers that |expired_requests| have been expired and | |
| 84 // removed from the queue, along with the |result|. | |
| 85 virtual void NotifyRequestsExpired( | |
|
Pete Williamson
2016/08/10 17:15:11
We will use the existing NotifyFailed for this. N
romax
2016/08/16 23:20:56
Done.
| |
| 86 const std::vector<SavePageRequest>& expired_requests, | |
| 87 RequestQueue::UpdateRequestResult result); | |
| 88 | |
| 83 // A way for tests to set the callback in use when an operation is over. | 89 // A way for tests to set the callback in use when an operation is over. |
| 84 void SetProcessingCallbackForTest(const base::Callback<void(bool)> callback) { | 90 void SetProcessingCallbackForTest(const base::Callback<void(bool)> callback) { |
| 85 scheduler_callback_ = callback; | 91 scheduler_callback_ = callback; |
| 86 } | 92 } |
| 87 | 93 |
| 88 // Returns the request queue used for requests. Coordinator keeps ownership. | 94 // Returns the request queue used for requests. Coordinator keeps ownership. |
| 89 RequestQueue* queue() { return queue_.get(); } | 95 RequestQueue* queue() { return queue_.get(); } |
| 90 | 96 |
| 91 // Return an unowned pointer to the Scheduler. | 97 // Return an unowned pointer to the Scheduler. |
| 92 Scheduler* scheduler() { return scheduler_.get(); } | 98 Scheduler* scheduler() { return scheduler_.get(); } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 base::TimeDelta offliner_timeout_; | 198 base::TimeDelta offliner_timeout_; |
| 193 // Allows us to pass a weak pointer to callbacks. | 199 // Allows us to pass a weak pointer to callbacks. |
| 194 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 200 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
| 195 | 201 |
| 196 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 202 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 197 }; | 203 }; |
| 198 | 204 |
| 199 } // namespace offline_pages | 205 } // namespace offline_pages |
| 200 | 206 |
| 201 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 207 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |