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/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 #endif | 181 #endif |
182 } | 182 } |
183 | 183 |
184 HistoryService* HistoryTabHelper::GetHistoryService() { | 184 HistoryService* HistoryTabHelper::GetHistoryService() { |
185 Profile* profile = | 185 Profile* profile = |
186 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 186 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
187 if (profile->IsOffTheRecord()) | 187 if (profile->IsOffTheRecord()) |
188 return NULL; | 188 return NULL; |
189 | 189 |
190 return HistoryServiceFactory::GetForProfile(profile, | 190 return HistoryServiceFactory::GetForProfile(profile, |
191 Profile::IMPLICIT_ACCESS); | 191 Profile::IMPLICIT_ACCESS).get(); |
192 } | 192 } |
193 | 193 |
194 void HistoryTabHelper::WebContentsDestroyed(WebContents* tab) { | 194 void HistoryTabHelper::WebContentsDestroyed(WebContents* tab) { |
195 // We update the history for this URL. | 195 // We update the history for this URL. |
196 // The content returned from web_contents() has been destroyed by now. | 196 // The content returned from web_contents() has been destroyed by now. |
197 // We need to use tab value directly. | 197 // We need to use tab value directly. |
198 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); | 198 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
199 if (profile->IsOffTheRecord()) | 199 if (profile->IsOffTheRecord()) |
200 return; | 200 return; |
201 | 201 |
202 HistoryService* hs = | 202 HistoryService* hs = |
203 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); | 203 HistoryServiceFactory::GetForProfile( |
| 204 profile, Profile::IMPLICIT_ACCESS).get(); |
204 if (hs) { | 205 if (hs) { |
205 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); | 206 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); |
206 if (entry) { | 207 if (entry) { |
207 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(), | 208 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(), |
208 base::Time::Now()); | 209 base::Time::Now()); |
209 } | 210 } |
210 } | 211 } |
211 } | 212 } |
OLD | NEW |