| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // Queues |request| to later load and save when system conditions allow. | 48 // Queues |request| to later load and save when system conditions allow. |
| 49 // Returns true if the page could be queued successfully. | 49 // Returns true if the page could be queued successfully. |
| 50 bool SavePageLater( | 50 bool SavePageLater( |
| 51 const GURL& url, const ClientId& client_id, bool user_reqeusted); | 51 const GURL& url, const ClientId& client_id, bool user_reqeusted); |
| 52 | 52 |
| 53 // Remove a list of requests by |request_id|. This removes requests from the | 53 // Remove a list of requests by |request_id|. This removes requests from the |
| 54 // request queue, but does not cancel an in-progress pre-render. | 54 // request queue, but does not cancel an in-progress pre-render. |
| 55 // TODO(petewil): Add code to cancel an in-progress pre-render. | 55 // TODO(petewil): Add code to cancel an in-progress pre-render. |
| 56 void RemoveRequests(const std::vector<int64_t>& request_ids); | 56 void RemoveRequests(const std::vector<int64_t>& request_ids); |
| 57 | 57 |
| 58 // Callback that receives the response for GetRequests. Client must | 58 // Pause a list of requests by |request_id|. This will change the state |
| 59 // in the request queue so the request cannot be started. |
| 60 // TODO(petewil): Add code to cancel an in-progress pre-render. |
| 61 void PauseRequests(const std::vector<int64_t>& request_ids); |
| 62 |
| 63 // Resume a list of previously paused requests, making them available. |
| 64 void ResumeRequests(const std::vector<int64_t>& request_ids); |
| 65 |
| 66 // Callback that receives the response for GetAllRequests. Client must |
| 59 // copy the result right away, it goes out of scope at the end of the | 67 // copy the result right away, it goes out of scope at the end of the |
| 60 // callback. | 68 // callback. |
| 61 typedef base::Callback<void(const std::vector<SavePageRequest>&)> | 69 typedef base::Callback<void(const std::vector<SavePageRequest>&)> |
| 62 GetRequestsCallback; | 70 GetRequestsCallback; |
| 63 | 71 |
| 64 // Get all save page request items in the callback. | 72 // Get all save page request items in the callback. |
| 65 void GetAllRequests(const GetRequestsCallback& callback); | 73 void GetAllRequests(const GetRequestsCallback& callback); |
| 66 | 74 |
| 67 // Starts processing of one or more queued save page later requests. | 75 // Starts processing of one or more queued save page later requests. |
| 68 // Returns whether processing was started and that caller should expect | 76 // Returns whether processing was started and that caller should expect |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 base::TimeDelta offliner_timeout_; | 200 base::TimeDelta offliner_timeout_; |
| 193 // Allows us to pass a weak pointer to callbacks. | 201 // Allows us to pass a weak pointer to callbacks. |
| 194 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 202 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
| 195 | 203 |
| 196 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 204 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 197 }; | 205 }; |
| 198 | 206 |
| 199 } // namespace offline_pages | 207 } // namespace offline_pages |
| 200 | 208 |
| 201 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 209 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |