| 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 CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/android/application_status_listener.h" | 10 #include "base/android/application_status_listener.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 OfflinePageModel* offline_page_model); | 37 OfflinePageModel* offline_page_model); |
| 38 ~BackgroundLoaderOffliner() override; | 38 ~BackgroundLoaderOffliner() override; |
| 39 | 39 |
| 40 static BackgroundLoaderOffliner* FromWebContents( | 40 static BackgroundLoaderOffliner* FromWebContents( |
| 41 content::WebContents* contents); | 41 content::WebContents* contents); |
| 42 | 42 |
| 43 // Offliner implementation. | 43 // Offliner implementation. |
| 44 bool LoadAndSave(const SavePageRequest& request, | 44 bool LoadAndSave(const SavePageRequest& request, |
| 45 const CompletionCallback& completion_callback, | 45 const CompletionCallback& completion_callback, |
| 46 const ProgressCallback& progress_callback) override; | 46 const ProgressCallback& progress_callback) override; |
| 47 void Cancel(const CancelCallback& callback) override; | 47 bool Cancel(const CancelCallback& callback) override; |
| 48 bool HandleTimeout(const SavePageRequest& request) override; | 48 bool HandleTimeout(int64_t request_id) override; |
| 49 | 49 |
| 50 // WebContentsObserver implementation. | 50 // WebContentsObserver implementation. |
| 51 void DocumentAvailableInMainFrame() override; | 51 void DocumentAvailableInMainFrame() override; |
| 52 void DocumentOnLoadCompletedInMainFrame() override; | 52 void DocumentOnLoadCompletedInMainFrame() override; |
| 53 void RenderProcessGone(base::TerminationStatus status) override; | 53 void RenderProcessGone(base::TerminationStatus status) override; |
| 54 void WebContentsDestroyed() override; | 54 void WebContentsDestroyed() override; |
| 55 void DidFinishNavigation( | 55 void DidFinishNavigation( |
| 56 content::NavigationHandle* navigation_handle) override; | 56 content::NavigationHandle* navigation_handle) override; |
| 57 | 57 |
| 58 // SnapshotController::Client implementation. | 58 // SnapshotController::Client implementation. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 70 | 70 |
| 71 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE }; | 71 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE }; |
| 72 enum PageLoadState { SUCCESS, RETRIABLE, NONRETRIABLE, DELAY_RETRY }; | 72 enum PageLoadState { SUCCESS, RETRIABLE, NONRETRIABLE, DELAY_RETRY }; |
| 73 | 73 |
| 74 // Called when the page has been saved. | 74 // Called when the page has been saved. |
| 75 void OnPageSaved(SavePageResult save_result, int64_t offline_id); | 75 void OnPageSaved(SavePageResult save_result, int64_t offline_id); |
| 76 | 76 |
| 77 // Called when application state has changed. | 77 // Called when application state has changed. |
| 78 void OnApplicationStateChange( | 78 void OnApplicationStateChange( |
| 79 base::android::ApplicationState application_state); | 79 base::android::ApplicationState application_state); |
| 80 void HandleApplicationStateChangeCancel(const SavePageRequest& request, | |
| 81 int64_t offline_id); | |
| 82 | 80 |
| 83 // Called to remember at what time we started loading. | 81 // Called to remember at what time we started loading. |
| 84 void MarkLoadStartTime(); | 82 void MarkLoadStartTime(); |
| 85 | 83 |
| 86 // Called to add a loading signal as we observe it. | 84 // Called to add a loading signal as we observe it. |
| 87 void AddLoadingSignal(const char* signal_name); | 85 void AddLoadingSignal(const char* signal_name); |
| 88 | 86 |
| 89 std::unique_ptr<background_loader::BackgroundLoaderContents> loader_; | 87 std::unique_ptr<background_loader::BackgroundLoaderContents> loader_; |
| 90 // Not owned. | 88 // Not owned. |
| 91 content::BrowserContext* browser_context_; | 89 content::BrowserContext* browser_context_; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 126 |
| 129 // Callback for cancel. | 127 // Callback for cancel. |
| 130 CancelCallback cancel_callback_; | 128 CancelCallback cancel_callback_; |
| 131 | 129 |
| 132 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; | 130 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; |
| 133 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); | 131 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); |
| 134 }; | 132 }; |
| 135 | 133 |
| 136 } // namespace offline_pages | 134 } // namespace offline_pages |
| 137 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ | 135 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ |
| OLD | NEW |