| Index: chrome/browser/android/offline_pages/recent_tab_helper.cc
|
| diff --git a/chrome/browser/android/offline_pages/recent_tab_helper.cc b/chrome/browser/android/offline_pages/recent_tab_helper.cc
|
| index a2019a31586b8f1c5fda136110dfc058743c1c1f..3e9bc62f549c6bf009ede639f2cfbd7faea9c02d 100644
|
| --- a/chrome/browser/android/offline_pages/recent_tab_helper.cc
|
| +++ b/chrome/browser/android/offline_pages/recent_tab_helper.cc
|
| @@ -247,10 +247,16 @@ void RecentTabHelper::WasHidden() {
|
| if (!IsOffliningRecentPagesEnabled())
|
| return;
|
|
|
| - // Return immediately if last_n is not listening to tab hidden events or if a
|
| - // last_n snapshot is currently being saved.
|
| - if (!last_n_listen_to_tab_hidden_ || last_n_ongoing_snapshot_info_)
|
| + // Return immediately if last_n is not listening to tab hidden events, if a
|
| + // last_n snapshot is currently being saved or if the tab is closing.
|
| + if (!last_n_listen_to_tab_hidden_ || last_n_ongoing_snapshot_info_ ||
|
| + tab_is_closing) {
|
| + DVLOG(1) << "Will not snapshot for last_n (reasons: "
|
| + << !last_n_listen_to_tab_hidden_ << ", "
|
| + << !!last_n_ongoing_snapshot_info_ << ", " << tab_is_closing
|
| + << ") for: " << web_contents()->GetLastCommittedURL().spec();
|
| return;
|
| + }
|
|
|
| // Do not save if page quality is too low.
|
| // Note: we assume page quality for a page can only increase.
|
| @@ -269,6 +275,19 @@ void RecentTabHelper::WasHidden() {
|
| last_n_ongoing_snapshot_info_.get()));
|
| }
|
|
|
| +void RecentTabHelper::WasShown() {
|
| + // If the tab was closing and is now being shown, the closure was reverted.
|
| + DVLOG_IF(0, tab_is_closing) << "Tab is not closing anymore: "
|
| + << web_contents()->GetLastCommittedURL().spec();
|
| + tab_is_closing = false;
|
| +}
|
| +
|
| +void RecentTabHelper::WillCloseTab() {
|
| + DVLOG(1) << "Tab is now closing: "
|
| + << web_contents()->GetLastCommittedURL().spec();
|
| + tab_is_closing = true;
|
| +}
|
| +
|
| // TODO(carlosk): rename this to RequestSnapshot and make it return a bool
|
| // representing the acceptance of the snapshot request.
|
| void RecentTabHelper::StartSnapshot() {
|
|
|