| 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(SnapshotController* controller); |
| 61 void OnNetworkBytesChanged(int64_t bytes); | 61 void OnNetworkBytesChanged(int64_t bytes); |
| 62 | 62 |
| 63 protected: | 63 protected: |
| 64 // Called to reset internal loader and observer state. | 64 // Called to reset internal loader and observer state. |
| 65 virtual void ResetState(); | 65 virtual void ResetState(); |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 friend class TestBackgroundLoaderOffliner; | 68 friend class TestBackgroundLoaderOffliner; |
| 69 | 69 |
| 70 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE }; | 70 enum SaveState { NONE, SAVING, DELETE_AFTER_SAVE }; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 96 ProgressCallback progress_callback_; | 96 ProgressCallback progress_callback_; |
| 97 // ApplicationStatusListener to monitor if Chrome moves to the foreground. | 97 // ApplicationStatusListener to monitor if Chrome moves to the foreground. |
| 98 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_; | 98 std::unique_ptr<base::android::ApplicationStatusListener> app_listener_; |
| 99 // Whether we are on a low-end device. | 99 // Whether we are on a low-end device. |
| 100 bool is_low_end_device_; | 100 bool is_low_end_device_; |
| 101 | 101 |
| 102 // Save state. | 102 // Save state. |
| 103 SaveState save_state_; | 103 SaveState save_state_; |
| 104 // Page load state. | 104 // Page load state. |
| 105 PageLoadState page_load_state_; | 105 PageLoadState page_load_state_; |
| 106 // Seconds to delay before taking snapshot. | |
| 107 long page_delay_ms_; | |
| 108 // Network bytes loaded. | 106 // Network bytes loaded. |
| 109 int64_t network_bytes_; | 107 int64_t network_bytes_; |
| 110 // Whether the low bar of snapshot quality has been met. | 108 // Whether the low bar of snapshot quality has been met. |
| 111 bool is_low_bar_met_; | 109 bool is_low_bar_met_; |
| 112 // Whether the snapshot is on the last retry. | 110 // Whether the snapshot is on the last retry. |
| 113 bool did_snapshot_on_last_retry_; | 111 bool did_snapshot_on_last_retry_; |
| 114 | 112 |
| 115 // Callback for cancel. | 113 // Callback for cancel. |
| 116 CancelCallback cancel_callback_; | 114 CancelCallback cancel_callback_; |
| 117 | 115 |
| 118 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; | 116 base::WeakPtrFactory<BackgroundLoaderOffliner> weak_ptr_factory_; |
| 119 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); | 117 DISALLOW_COPY_AND_ASSIGN(BackgroundLoaderOffliner); |
| 120 }; | 118 }; |
| 121 | 119 |
| 122 } // namespace offline_pages | 120 } // namespace offline_pages |
| 123 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ | 121 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_BACKGROUND_LOADER_OFFLINER_H_ |
| OLD | NEW |