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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 } | 175 } |
176 | 176 |
177 void HistoryTabHelper::WebContentsDestroyed(WebContents* tab) { | 177 void HistoryTabHelper::WebContentsDestroyed(WebContents* tab) { |
178 // We update the history for this URL. | 178 // We update the history for this URL. |
179 // The content returned from web_contents() has been destroyed by now. | 179 // The content returned from web_contents() has been destroyed by now. |
180 // We need to use tab value directly. | 180 // We need to use tab value directly. |
181 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); | 181 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
182 if (profile->IsOffTheRecord()) | 182 if (profile->IsOffTheRecord()) |
183 return; | 183 return; |
184 | 184 |
185 HistoryService* hs = | 185 HistoryService* hs = HistoryServiceFactory::GetForProfileIfExists( |
186 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); | 186 profile, Profile::IMPLICIT_ACCESS); |
187 if (hs) { | 187 if (hs) { |
188 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); | 188 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); |
189 if (entry) { | 189 if (entry) { |
190 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(), | 190 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(), |
191 base::Time::Now()); | 191 base::Time::Now()); |
192 } | 192 } |
193 } | 193 } |
194 } | 194 } |
OLD | NEW |