| 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" |
| 11 #include "components/offline_pages/core/background/resource_data_type.h" |
| 11 | 12 |
| 12 namespace offline_pages { | 13 namespace offline_pages { |
| 13 | 14 |
| 14 class SavePageRequest; | 15 class SavePageRequest; |
| 15 | 16 |
| 16 // Interface of a class responsible for constructing an offline page given | 17 // Interface of a class responsible for constructing an offline page given |
| 17 // a request with a URL. | 18 // a request with a URL. |
| 18 class Offliner { | 19 class Offliner { |
| 19 public: | 20 public: |
| 20 // Status of processing an offline page request. | 21 // Status of processing an offline page request. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Clears the currently processing request, if any, and skips running its | 96 // Clears the currently processing request, if any, and skips running its |
| 96 // CompletionCallback. Returns false if there is nothing to cancel, otherwise | 97 // CompletionCallback. Returns false if there is nothing to cancel, otherwise |
| 97 // returns true and canceled request will be delivered using callback. | 98 // returns true and canceled request will be delivered using callback. |
| 98 virtual bool Cancel(const CancelCallback& callback) = 0; | 99 virtual bool Cancel(const CancelCallback& callback) = 0; |
| 99 | 100 |
| 100 // Handles timeout scenario. Returns true if lowbar is met and try to do a | 101 // 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 | 102 // snapshot of the current webcontents. If that is the case, the result of |
| 102 // offlining will be provided by |completion_callback|. | 103 // offlining will be provided by |completion_callback|. |
| 103 virtual bool HandleTimeout(int64_t request_id) = 0; | 104 virtual bool HandleTimeout(int64_t request_id) = 0; |
| 104 | 105 |
| 106 // We are notified of a resource load starting or ending, we can use this |
| 107 // for tracking loading signals. |
| 108 virtual void ObserveResourceTracking(const ResourceDataType type, |
| 109 int64_t started_count, |
| 110 int64_t completed_count) = 0; |
| 111 |
| 105 // TODO(dougarnett): add policy support methods. | 112 // TODO(dougarnett): add policy support methods. |
| 106 }; | 113 }; |
| 107 | 114 |
| 108 } // namespace offline_pages | 115 } // namespace offline_pages |
| 109 | 116 |
| 110 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ | 117 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ |
| OLD | NEW |