| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 // Returns true if the page could be queued successfully. | 71 // Returns true if the page could be queued successfully. |
| 72 bool SavePageLater( | 72 bool SavePageLater( |
| 73 const GURL& url, const ClientId& client_id, bool user_reqeusted); | 73 const GURL& url, const ClientId& client_id, bool user_reqeusted); |
| 74 | 74 |
| 75 // Callback specifying which request IDs were actually removed. | 75 // Callback specifying which request IDs were actually removed. |
| 76 typedef base::Callback<void( | 76 typedef base::Callback<void( |
| 77 const RequestQueue::UpdateMultipleRequestResults&)> | 77 const RequestQueue::UpdateMultipleRequestResults&)> |
| 78 RemoveRequestsCallback; | 78 RemoveRequestsCallback; |
| 79 | 79 |
| 80 // Remove a list of requests by |request_id|. This removes requests from the | 80 // Remove a list of requests by |request_id|. This removes requests from the |
| 81 // request queue, but does not cancel an in-progress pre-render. | 81 // request queue, and cancels an in-progress prerender. |
| 82 // TODO(petewil): Add code to cancel an in-progress pre-render. | |
| 83 void RemoveRequests(const std::vector<int64_t>& request_ids, | 82 void RemoveRequests(const std::vector<int64_t>& request_ids, |
| 84 const RemoveRequestsCallback& callback); | 83 const RemoveRequestsCallback& callback); |
| 85 | 84 |
| 86 // Pause a list of requests by |request_id|. This will change the state | 85 // Pause a list of requests by |request_id|. This will change the state |
| 87 // in the request queue so the request cannot be started. | 86 // in the request queue so the request cannot be started. |
| 88 // TODO(petewil): Add code to cancel an in-progress pre-render. | |
| 89 void PauseRequests(const std::vector<int64_t>& request_ids); | 87 void PauseRequests(const std::vector<int64_t>& request_ids); |
| 90 | 88 |
| 91 // Resume a list of previously paused requests, making them available. | 89 // Resume a list of previously paused requests, making them available. |
| 92 void ResumeRequests(const std::vector<int64_t>& request_ids); | 90 void ResumeRequests(const std::vector<int64_t>& request_ids); |
| 93 | 91 |
| 94 // Callback that receives the response for GetAllRequests. Client must | 92 // Callback that receives the response for GetAllRequests. Client must |
| 95 // copy the result right away, it goes out of scope at the end of the | 93 // copy the result right away, it goes out of scope at the end of the |
| 96 // callback. | 94 // callback. |
| 97 typedef base::Callback<void(const std::vector<SavePageRequest>&)> | 95 typedef base::Callback<void(const std::vector<SavePageRequest>&)> |
| 98 GetRequestsCallback; | 96 GetRequestsCallback; |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 base::TimeDelta offliner_timeout_; | 301 base::TimeDelta offliner_timeout_; |
| 304 // Allows us to pass a weak pointer to callbacks. | 302 // Allows us to pass a weak pointer to callbacks. |
| 305 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 303 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
| 306 | 304 |
| 307 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 305 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 308 }; | 306 }; |
| 309 | 307 |
| 310 } // namespace offline_pages | 308 } // namespace offline_pages |
| 311 | 309 |
| 312 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 310 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |