| 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_CORE_BACKGROUND_OFFLINER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // number of bytes received from the network (for UI purposes). | 90 // number of bytes received from the network (for UI purposes). |
| 91 virtual bool LoadAndSave(const SavePageRequest& request, | 91 virtual bool LoadAndSave(const SavePageRequest& request, |
| 92 const CompletionCallback& completion_callback, | 92 const CompletionCallback& completion_callback, |
| 93 const ProgressCallback& progress_callback) = 0; | 93 const ProgressCallback& progress_callback) = 0; |
| 94 | 94 |
| 95 // Clears the currently processing request, if any, and skips running its | 95 // Clears the currently processing request, if any, and skips running its |
| 96 // CompletionCallback. Returns false if there is nothing to cancel, otherwise | 96 // CompletionCallback. Returns false if there is nothing to cancel, otherwise |
| 97 // returns true and canceled request will be delivered using callback. | 97 // returns true and canceled request will be delivered using callback. |
| 98 virtual bool Cancel(const CancelCallback& callback) = 0; | 98 virtual bool Cancel(const CancelCallback& callback) = 0; |
| 99 | 99 |
| 100 // On some external condition changes (RAM pressure, browser backgrounded on |
| 101 // low-level devices, etc) it is needed to terminate a load if there is one |
| 102 // in progress. It is no-op if there is no active request loading. |
| 103 virtual void TerminateLoadIfInProgress() = 0; |
| 104 |
| 100 // Handles timeout scenario. Returns true if lowbar is met and try to do a | 105 // Handles timeout scenario. Returns true if lowbar is met and try to do a |
| 101 // snapshot of the current webcontents. If that is the case, the result of | 106 // snapshot of the current webcontents. If that is the case, the result of |
| 102 // offlining will be provided by |completion_callback|. | 107 // offlining will be provided by |completion_callback|. |
| 103 virtual bool HandleTimeout(int64_t request_id) = 0; | 108 virtual bool HandleTimeout(int64_t request_id) = 0; |
| 104 | 109 |
| 105 // TODO(dougarnett): add policy support methods. | 110 // TODO(dougarnett): add policy support methods. |
| 106 }; | 111 }; |
| 107 | 112 |
| 108 } // namespace offline_pages | 113 } // namespace offline_pages |
| 109 | 114 |
| 110 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ | 115 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ |
| OLD | NEW |