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

Unified Diff: chrome/browser/memory/tab_manager.cc

Issue 1826333002: [TabManager] Protect tabs opened in background. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: chrisha@ comments. Created 4 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
« no previous file with comments | « chrome/browser/memory/tab_manager.h ('k') | chrome/browser/memory/tab_manager_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/memory/tab_manager.cc
diff --git a/chrome/browser/memory/tab_manager.cc b/chrome/browser/memory/tab_manager.cc
index 096a786cf67963497b9fc99a1f5c7f4699d3265d..8bd8dca30dfcd99edc8b5823f3e5d6ec8748ab4b 100644
--- a/chrome/browser/memory/tab_manager.cc
+++ b/chrome/browser/memory/tab_manager.cc
@@ -361,6 +361,19 @@ void TabManager::ActiveTabChanged(content::WebContents* old_contents,
GetWebContentsData(old_contents)->SetLastInactiveTime(NowTicks());
}
+void TabManager::TabInsertedAt(content::WebContents* contents,
+ int index,
+ bool foreground) {
+ // Only interested in background tabs, as foreground tabs get taken care of by
+ // ActiveTabChanged.
+ if (foreground)
+ return;
+
+ // A new background tab is similar to having a tab switch from being active to
+ // inactive.
+ GetWebContentsData(contents)->SetLastInactiveTime(NowTicks());
+}
+
///////////////////////////////////////////////////////////////////////////////
// TabManager, private:
« no previous file with comments | « chrome/browser/memory/tab_manager.h ('k') | chrome/browser/memory/tab_manager_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698