| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 std::unique_ptr<RequestQueue> queue, | 43 std::unique_ptr<RequestQueue> queue, |
| 44 std::unique_ptr<Scheduler> scheduler); | 44 std::unique_ptr<Scheduler> scheduler); |
| 45 | 45 |
| 46 ~RequestCoordinator() override; | 46 ~RequestCoordinator() override; |
| 47 | 47 |
| 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 |client_id|. This removes requests from the |
| 54 // request queue, but does not cancel an in-progress pre-render. |
| 55 // TODO(petewil): Add code to cancel an in-progress pre-render. |
| 56 void RemoveRequests(const std::vector<ClientId>& client_ids); |
| 57 |
| 53 // Starts processing of one or more queued save page later requests. | 58 // Starts processing of one or more queued save page later requests. |
| 54 // Returns whether processing was started and that caller should expect | 59 // Returns whether processing was started and that caller should expect |
| 55 // a callback. If processing was already active, returns false. | 60 // a callback. If processing was already active, returns false. |
| 56 bool StartProcessing(const DeviceConditions& device_conditions, | 61 bool StartProcessing(const DeviceConditions& device_conditions, |
| 57 const base::Callback<void(bool)>& callback); | 62 const base::Callback<void(bool)>& callback); |
| 58 | 63 |
| 59 // Stops the current request processing if active. This is a way for | 64 // Stops the current request processing if active. This is a way for |
| 60 // caller to abort processing; otherwise, processing will complete on | 65 // caller to abort processing; otherwise, processing will complete on |
| 61 // its own. In either case, the callback will be called when processing | 66 // its own. In either case, the callback will be called when processing |
| 62 // is stopped or complete. | 67 // is stopped or complete. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 base::TimeDelta offliner_timeout_; | 167 base::TimeDelta offliner_timeout_; |
| 163 // Allows us to pass a weak pointer to callbacks. | 168 // Allows us to pass a weak pointer to callbacks. |
| 164 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 169 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
| 165 | 170 |
| 166 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 171 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 167 }; | 172 }; |
| 168 | 173 |
| 169 } // namespace offline_pages | 174 } // namespace offline_pages |
| 170 | 175 |
| 171 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 176 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |