OLD | NEW |
---|---|
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 Loading... | |
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. | |
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
| |
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->UpdateDBWithPageInfo(tab, entry->GetPageID(), tab->GetURL(), | |
188 base::Time::Now()); | |
189 } | |
190 } | |
191 } | |
OLD | NEW |