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

Side by Side Diff: chrome/browser/history/history_tab_helper.cc

Issue 10014007: Change 9789001: attempt #3 after fixing the problems with linux Created by Wei Li: https://chromium… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/history/history_tab_helper.h ('k') | chrome/browser/history/history_types.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/history/history_tab_helper.h" 5 #include "chrome/browser/history/history_tab_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "chrome/browser/history/history.h" 9 #include "chrome/browser/history/history.h"
10 #include "chrome/browser/history/top_sites.h" 10 #include "chrome/browser/history/top_sites.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 } 164 }
165 165
166 HistoryService* HistoryTabHelper::GetHistoryService() { 166 HistoryService* HistoryTabHelper::GetHistoryService() {
167 Profile* profile = 167 Profile* profile =
168 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 168 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
169 if (profile->IsOffTheRecord()) 169 if (profile->IsOffTheRecord())
170 return NULL; 170 return NULL;
171 171
172 return profile->GetHistoryService(Profile::IMPLICIT_ACCESS); 172 return profile->GetHistoryService(Profile::IMPLICIT_ACCESS);
173 } 173 }
174
175 void HistoryTabHelper::WebContentsDestroyed(WebContents* tab) {
176 // We update the history for this URL.
177 // The content returned from web_contents() has been destroyed by now.
178 // We need to use tab value directly.
179 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext());
180 if (profile->IsOffTheRecord())
181 return;
182
183 HistoryService* hs = profile->GetHistoryService(Profile::IMPLICIT_ACCESS);
184 if (hs) {
185 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry();
186 if (entry) {
187 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(),
188 base::Time::Now());
189 }
190 }
191 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history_tab_helper.h ('k') | chrome/browser/history/history_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698