Chromium Code Reviews| Index: chrome/browser/android/offline_pages/background_loader_offliner.h |
| diff --git a/chrome/browser/android/offline_pages/background_loader_offliner.h b/chrome/browser/android/offline_pages/background_loader_offliner.h |
| index f1b611bb33090756f14e41c69930d45bf2577cbd..0d18abe1ae71614b4051229efd62431ff801a34a 100644 |
| --- a/chrome/browser/android/offline_pages/background_loader_offliner.h |
| +++ b/chrome/browser/android/offline_pages/background_loader_offliner.h |
| @@ -34,6 +34,9 @@ class BackgroundLoaderOffliner : public Offliner, |
| OfflinePageModel* offline_page_model); |
| ~BackgroundLoaderOffliner() override; |
| + static BackgroundLoaderOffliner* FromWebContents( |
| + content::WebContents* contents); |
| + |
| // Offliner implementation. |
| bool LoadAndSave(const SavePageRequest& request, |
| const CompletionCallback& completion_callback, |
| @@ -49,6 +52,7 @@ class BackgroundLoaderOffliner : public Offliner, |
| content::NavigationHandle* navigation_handle) override; |
| void SetPageDelayForTest(long delay_ms); |
| + void OnNetworkBytesChanged(int64_t bytes); |
| protected: |
| // Called to reset internal loader and observer state. |
| @@ -56,6 +60,8 @@ class BackgroundLoaderOffliner : public Offliner, |
| private: |
| friend class TestBackgroundLoaderOffliner; |
| + // Currently there should only be one offliner created... |
| + static BackgroundLoaderOffliner* offliner_; |
|
Dmitry Titov
2017/03/09 03:15:55
Perhaps this can be avoided by setting the Backgro
|
| enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE }; |
| enum PageLoadState { SUCCESS, RETRIABLE, NONRETRIABLE, DELAY_RETRY }; |
| @@ -81,6 +87,8 @@ class BackgroundLoaderOffliner : public Offliner, |
| std::unique_ptr<SavePageRequest> pending_request_; |
| // Callback when pending request completes. |
| CompletionCallback completion_callback_; |
| + // Callback to report progress. |
| + ProgressCallback progress_callback_; |
| // ApplicationStatusListener to monitor if Chrome moves to the foreground. |
| std::unique_ptr<base::android::ApplicationStatusListener> app_listener_; |
| // Whether we are on a low-end device. |
| @@ -92,6 +100,8 @@ class BackgroundLoaderOffliner : public Offliner, |
| PageLoadState page_load_state_; |
| // Seconds to delay before taking snapshot. |
| long page_delay_ms_; |
| + // Network bytes loaded. |
| + int64_t network_bytes_; |
| // Callback for cancel. |
| CancelCallback cancel_callback_; |