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

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

Issue 1867343002: [TabManager] [Merge M50] Protect tabs opened in background. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 8 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 17440aab115ac09dfb293350537c59fb1e03c055..3f9a83a9c706b55a0c4a59e5a14c0eba1dc5c0fa 100644
--- a/chrome/browser/memory/tab_manager.cc
+++ b/chrome/browser/memory/tab_manager.cc
@@ -350,6 +350,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