| Index: chrome/browser/android/offline_pages/recent_tab_helper.h
|
| diff --git a/chrome/browser/android/offline_pages/recent_tab_helper.h b/chrome/browser/android/offline_pages/recent_tab_helper.h
|
| index 94c69e4ff1bd586eb30f75bfb41957955e2ebe7a..da26060675de9b0afc90da0dc91382104c3c1636 100644
|
| --- a/chrome/browser/android/offline_pages/recent_tab_helper.h
|
| +++ b/chrome/browser/android/offline_pages/recent_tab_helper.h
|
| @@ -22,6 +22,8 @@ class NavigationHandle;
|
|
|
| namespace offline_pages {
|
|
|
| +using PageQuality = SnapshotController::PageQuality;
|
| +
|
| // Attaches to every WebContent shown in a tab. Waits until the WebContent is
|
| // loaded to proper degree and then makes a snapshot of the page. Removes the
|
| // oldest snapshot in the 'ring buffer'. As a result, there is always up to N
|
| @@ -39,6 +41,7 @@ class RecentTabHelper
|
| void DocumentAvailableInMainFrame() override;
|
| void DocumentOnLoadCompletedInMainFrame() override;
|
| void WebContentsDestroyed() override;
|
| + void WasHidden() override;
|
|
|
| // SnapshotController::Client
|
| void StartSnapshot() override;
|
| @@ -102,18 +105,20 @@ class RecentTabHelper
|
| void ReportDownloadStatusToRequestCoordinator();
|
| bool IsSamePage() const;
|
| ClientId GetRecentPagesClientId() const;
|
| + void StartSnapshotInternal();
|
| + bool isSnapshottingForLastN() const;
|
|
|
| // Page model is a service, no ownership. Can be null - for example, in
|
| // case when tab is in incognito profile.
|
| - OfflinePageModel* page_model_;
|
| + OfflinePageModel* page_model_ = nullptr;
|
|
|
| // If false, never make snapshots off the attached WebContents.
|
| // Not page-specific.
|
| - bool snapshots_enabled_;
|
| + bool snapshots_enabled_ = false;
|
|
|
| // Becomes true during navigation if the page is ready for snapshot as
|
| // indicated by at least one callback from SnapshotController.
|
| - bool is_page_ready_for_snapshot_;
|
| + bool is_page_ready_for_snapshot_ = false;
|
|
|
| // Info for the offline page to capture. Null if the tab is not capturing
|
| // current page.
|
| @@ -131,6 +136,16 @@ class RecentTabHelper
|
|
|
| std::unique_ptr<Delegate> delegate_;
|
|
|
| + // Per navigation state set if last_n should listed to the tab being hidden to
|
| + // save a snapshot. Only used if using user interaction events as triggers.
|
| + bool last_n_listen_to_tab_hidden_ = false;
|
| +
|
| + // Members to track page quality status for a current save being executed and
|
| + // the last saved page. Only used if using user interaction events as
|
| + // triggers.
|
| + PageQuality last_n_saved_quality_ = PageQuality::POOR;
|
| + PageQuality page_quality_on_save_start_ = PageQuality::POOR;
|
| +
|
| base::WeakPtrFactory<RecentTabHelper> weak_ptr_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(RecentTabHelper);
|
|
|