| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 void DocumentAvailableInMainFrame() override; | 50 void DocumentAvailableInMainFrame() override; |
| 51 void DocumentOnLoadCompletedInMainFrame() override; | 51 void DocumentOnLoadCompletedInMainFrame() override; |
| 52 void RenderProcessGone(base::TerminationStatus status) override; | 52 void RenderProcessGone(base::TerminationStatus status) override; |
| 53 void WebContentsDestroyed() override; | 53 void WebContentsDestroyed() override; |
| 54 void DidFinishNavigation( | 54 void DidFinishNavigation( |
| 55 content::NavigationHandle* navigation_handle) override; | 55 content::NavigationHandle* navigation_handle) override; |
| 56 | 56 |
| 57 // SnapshotController::Client implementation. | 57 // SnapshotController::Client implementation. |
| 58 void StartSnapshot() override; | 58 void StartSnapshot() override; |
| 59 | 59 |
| 60 void SetPageDelayForTest(long delay_ms); | 60 void SetSnapshotControllerForTest( |
| 61 std::unique_ptr<SnapshotController> controller); |
| 61 void OnNetworkBytesChanged(int64_t bytes); | 62 void OnNetworkBytesChanged(int64_t bytes); |
| 62 | 63 |
| 63 protected: | 64 protected: |
| 64 // Called to reset internal loader and observer state. | 65 // Called to reset internal loader and observer state. |
| 65 virtual void ResetState(); | 66 virtual void ResetState(); |
| 66 | 67 |
| 67 private: | 68 private: |
| 68 friend class TestBackgroundLoaderOffliner; | 69 friend class TestBackgroundLoaderOffliner; |
| 69 | 70 |
| 70 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE }; | 71 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE }; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 94 ProgressCallback progress_callback_; | 95 ProgressCallback progress_callback_; |
| 95 // ApplicationStatusListener to monitor if Chrome moves to the foreground. | 96 // ApplicationStatusListener to monitor if Chrome moves to the foreground. |
| 96 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_; | 97 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_; |
| 97 // Whether we are on a low-end device. | 98 // Whether we are on a low-end device. |
| 98 bool is_low_end_device_; | 99 bool is_low_end_device_; |
| 99 | 100 |
| 100 // Save state. | 101 // Save state. |
| 101 SaveState save_state_; | 102 SaveState save_state_; |
| 102 // Page load state. | 103 // Page load state. |
| 103 PageLoadState page_load_state_; | 104 PageLoadState page_load_state_; |
| 104 // Seconds to delay before taking snapshot. | |
| 105 long page_delay_ms_; | |
| 106 // Network bytes loaded. | 105 // Network bytes loaded. |
| 107 int64_t network_bytes_; | 106 int64_t network_bytes_; |
| 108 | 107 |
| 109 // Callback for cancel. | 108 // Callback for cancel. |
| 110 CancelCallback cancel_callback_; | 109 CancelCallback cancel_callback_; |
| 111 | 110 |
| 112 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; | 111 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; |
| 113 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); | 112 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); |
| 114 }; | 113 }; |
| 115 | 114 |
| 116 } // namespace offline_pages | 115 } // namespace offline_pages |
| 117 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ | 116 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ |
| OLD | NEW |