Index: chrome/browser/history/history_tab_helper.cc |
diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc |
index 83a5356145c986ef548755e346d5231582900b39..aab0bfc16fe1086f263e68175ea1ec6cd1b20df3 100644 |
--- a/chrome/browser/history/history_tab_helper.cc |
+++ b/chrome/browser/history/history_tab_helper.cc |
@@ -171,3 +171,21 @@ HistoryService* HistoryTabHelper::GetHistoryService() { |
return profile->GetHistoryService(Profile::IMPLICIT_ACCESS); |
} |
+ |
+void HistoryTabHelper::WebContentsDestroyed(WebContents* tab) { |
+ // We update the history for this URL. |
+ // The content returned from web_contents() has been destroyed by now. |
+ // We need to use tab value directly. |
+ Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
+ if (profile->IsOffTheRecord()) |
+ return; |
+ |
+ HistoryService* hs = profile->GetHistoryService(Profile::IMPLICIT_ACCESS); |
+ if (hs) { |
+ NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); |
+ if (entry) { |
+ hs->UpdatePageInfo(tab, entry->GetPageID(), tab->GetURL(), |
+ base::Time::Now()); |
+ } |
+ } |
+} |