| 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_RECENT_TAB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ |
| 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // downloads. Null if no successful one has ever completed. | 126 // downloads. Null if no successful one has ever completed. |
| 127 std::unique_ptr<SnapshotProgressInfo> downloads_latest_saved_snapshot_info_; | 127 std::unique_ptr<SnapshotProgressInfo> downloads_latest_saved_snapshot_info_; |
| 128 | 128 |
| 129 // Snapshot progress information for a last_n triggered request. Null if | 129 // Snapshot progress information for a last_n triggered request. Null if |
| 130 // last_n is not currently capturing the current page. | 130 // last_n is not currently capturing the current page. |
| 131 std::unique_ptr<SnapshotProgressInfo> last_n_ongoing_snapshot_info_; | 131 std::unique_ptr<SnapshotProgressInfo> last_n_ongoing_snapshot_info_; |
| 132 | 132 |
| 133 // If empty, the tab does not have AndroidId and can not capture pages. | 133 // If empty, the tab does not have AndroidId and can not capture pages. |
| 134 std::string tab_id_; | 134 std::string tab_id_; |
| 135 | 135 |
| 136 // The URL of the page that is currently being snapshotted. Used to check, | |
| 137 // during async operations, that WebContents still contains the same page. | |
| 138 GURL snapshot_url_; | |
| 139 | |
| 140 // Monitors page loads and starts snapshots when a download request exist. It | 136 // Monitors page loads and starts snapshots when a download request exist. It |
| 141 // is also used as an initialization flag for EnsureInitialized() to be run | 137 // is also used as an initialization flag for EnsureInitialized() to be run |
| 142 // only once. | 138 // only once. |
| 143 std::unique_ptr<SnapshotController> snapshot_controller_; | 139 std::unique_ptr<SnapshotController> snapshot_controller_; |
| 144 | 140 |
| 145 std::unique_ptr<Delegate> delegate_; | 141 std::unique_ptr<Delegate> delegate_; |
| 146 | 142 |
| 147 // Set at each navigation to control if last_n should save snapshots of the | 143 // Set at each navigation to control if last_n should save snapshots of the |
| 148 // current page being loaded. | 144 // current page being loaded. |
| 149 bool last_n_listen_to_tab_hidden_ = false; | 145 bool last_n_listen_to_tab_hidden_ = false; |
| 150 | 146 |
| 151 // Track the page quality status of the last saved snapshot for the current | |
| 152 // page. It is generally reset upon new navigations. | |
| 153 SnapshotController::PageQuality last_n_latest_saved_quality_ = | |
| 154 SnapshotController::PageQuality::POOR; | |
| 155 | |
| 156 base::WeakPtrFactory<RecentTabHelper> weak_ptr_factory_; | 147 base::WeakPtrFactory<RecentTabHelper> weak_ptr_factory_; |
| 157 | 148 |
| 158 DISALLOW_COPY_AND_ASSIGN(RecentTabHelper); | 149 DISALLOW_COPY_AND_ASSIGN(RecentTabHelper); |
| 159 }; | 150 }; |
| 160 | 151 |
| 161 } // namespace offline_pages | 152 } // namespace offline_pages |
| 162 | 153 |
| 163 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ | 154 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_RECENT_TAB_HELPER_H_ |
| OLD | NEW |