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

Unified Diff: chrome/browser/ui/browser.cc

Issue 1131373003: [Session restore] Add MRU logic to loading of background pages. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unnecessary change in tab_restore_service.h Created 5 years, 7 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/ui/browser.cc
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index c1556d9e1bb6c69324779bc9d7c71a1975e8835d..807648db989eec88c99d21527c5632dcb79b45a6 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -70,6 +70,7 @@
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/repost_form_warning_controller.h"
#include "chrome/browser/search/search.h"
+#include "chrome/browser/sessions/session_restore.h"
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/sessions/session_tab_helper.h"
@@ -1071,13 +1072,21 @@ void Browser::ActiveTabChanged(WebContents* old_contents,
find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect());
}
- // Update sessions. Don't force creation of sessions. If sessions doesn't
- // exist, the change will be picked up by sessions when created.
+ // Update sessions (selected tab index and last active time). Don't force
+ // creation of sessions. If sessions doesn't exist, the change will be picked
+ // up by sessions when created.
SessionService* session_service =
SessionServiceFactory::GetForProfileIfExisting(profile_);
if (session_service && !tab_strip_model_->closing_all()) {
session_service->SetSelectedTabInWindow(session_id(),
tab_strip_model_->active_index());
+ if (SessionRestore::GetSmartRestoreMode() ==
+ SessionRestore::SMART_RESTORE_MODE_MRU) {
+ SessionTabHelper* session_tab_helper =
+ SessionTabHelper::FromWebContents(new_contents);
+ session_service->SetLastActiveTime(
+ session_id(), session_tab_helper->session_id(), base::Time::Now());
+ }
}
// This needs to be called after notifying SearchDelegate.

Powered by Google App Engine
This is Rietveld 408576698