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

Unified Diff: chrome/browser/history/history_tab_helper.cc

Issue 9789001: Changes to add duration into history database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added a column in visits db instead of a new table Created 8 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/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..4562d43990171bfb81c3af532db2845352f94eff 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.
GeorgeY 2012/03/27 21:15:57 May be // We need to use tab value directly as a h
Wei Li 2012/03/27 23:01:50 It is not used as a hash, but a pointer as it pass
+ 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->UpdateDBWithPageInfo(tab, entry->GetPageID(), tab->GetURL(),
+ base::Time::Now());
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698