| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // Clears the currently processing request, if any, and skips running its | 87 // Clears the currently processing request, if any, and skips running its |
| 87 // CompletionCallback. Returns false if there is nothing to cancel, otherwise | 88 // CompletionCallback. Returns false if there is nothing to cancel, otherwise |
| 88 // returns true and canceled request will be delivered using callback. | 89 // returns true and canceled request will be delivered using callback. |
| 89 virtual bool Cancel(const CancelCallback& callback) = 0; | 90 virtual bool Cancel(const CancelCallback& callback) = 0; |
| 90 | 91 |
| 91 // Handles timeout scenario. Returns true if lowbar is met and try to do a | 92 // Handles timeout scenario. Returns true if lowbar is met and try to do a |
| 92 // snapshot of the current webcontents. If that is the case, the result of | 93 // snapshot of the current webcontents. If that is the case, the result of |
| 93 // offlining will be provided by |completion_callback|. | 94 // offlining will be provided by |completion_callback|. |
| 94 virtual bool HandleTimeout(int64_t request_id) = 0; | 95 virtual bool HandleTimeout(int64_t request_id) = 0; |
| 95 | 96 |
| 97 // We are notified of a resource load starting or ending, we can use this |
| 98 // for tracking loading signals. |
| 99 virtual void ObserveResourceTracking(const ResourceDataType type, |
| 100 int64_t started_count, |
| 101 int64_t completed_count) = 0; |
| 102 |
| 96 // TODO(dougarnett): add policy support methods. | 103 // TODO(dougarnett): add policy support methods. |
| 97 }; | 104 }; |
| 98 | 105 |
| 99 } // namespace offline_pages | 106 } // namespace offline_pages |
| 100 | 107 |
| 101 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ | 108 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_H_ |
| OLD | NEW |