Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: chrome/browser/android/offline_pages/recent_tab_helper.cc

Issue 2773273002: Last_n: do not save snapshot of custom tabs. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 c7aab9f6145608af525dcc97792876fbeda9746a..7f6a91f66431e7e4a08c6d93b2c5b6cecde324db 100644
--- a/chrome/browser/android/offline_pages/recent_tab_helper.cc
+++ b/chrome/browser/android/offline_pages/recent_tab_helper.cc
@@ -49,6 +49,10 @@ class DefaultDelegate: public offline_pages::RecentTabHelper::Delegate {
}
bool IsLowEndDevice() override { return is_low_end_device_; }
+ bool IsCustomTab(content::WebContents* web_contents) override {
+ return offline_pages::OfflinePageUtils::IsCurrentlyACustomTab(web_contents);
+ }
+
private:
// Cached value of whether low end device.
bool is_low_end_device_;
@@ -266,13 +270,17 @@ void RecentTabHelper::WasHidden() {
if (!IsOffliningRecentPagesEnabled())
return;
- // 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.
+ // Do not save a snapshots if any of these are true:
+ // - Last_n is not listening to tab hidden events.
+ // - A last_n snapshot is currently being saved.
+ // - The tab is in the process of being closed.
+ // - The tab is currently presented as a custom tab.
if (!last_n_listen_to_tab_hidden_ || last_n_ongoing_snapshot_info_ ||
- tab_is_closing_) {
+ tab_is_closing_ || delegate_->IsCustomTab(web_contents())) {
DVLOG(1) << "Will not snapshot for last_n (reasons: "
<< !last_n_listen_to_tab_hidden_ << ", "
<< !!last_n_ongoing_snapshot_info_ << ", " << tab_is_closing_
+ << ", " << delegate_->IsCustomTab(web_contents())
<< ") for: " << web_contents()->GetLastCommittedURL().spec();
return;
}

Powered by Google App Engine
This is Rietveld 408576698