| 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_service.h" | 9 #include "chrome/browser/history/history_service.h" |
| 10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 received_page_title_ = explicit_set; | 135 received_page_title_ = explicit_set; |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 HistoryService* HistoryTabHelper::GetHistoryService() { | 139 HistoryService* HistoryTabHelper::GetHistoryService() { |
| 140 Profile* profile = | 140 Profile* profile = |
| 141 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); | 141 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); |
| 142 if (profile->IsOffTheRecord()) | 142 if (profile->IsOffTheRecord()) |
| 143 return NULL; | 143 return NULL; |
| 144 | 144 |
| 145 return HistoryServiceFactory::GetForProfile(profile, | 145 return HistoryServiceFactory::GetForProfile( |
| 146 Profile::IMPLICIT_ACCESS); | 146 profile, ServiceAccessType::IMPLICIT_ACCESS); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void HistoryTabHelper::WebContentsDestroyed() { | 149 void HistoryTabHelper::WebContentsDestroyed() { |
| 150 // We update the history for this URL. | 150 // We update the history for this URL. |
| 151 WebContents* tab = web_contents(); | 151 WebContents* tab = web_contents(); |
| 152 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); | 152 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
| 153 if (profile->IsOffTheRecord()) | 153 if (profile->IsOffTheRecord()) |
| 154 return; | 154 return; |
| 155 | 155 |
| 156 HistoryService* hs = | 156 HistoryService* hs = HistoryServiceFactory::GetForProfile( |
| 157 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); | 157 profile, ServiceAccessType::IMPLICIT_ACCESS); |
| 158 if (hs) { | 158 if (hs) { |
| 159 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); | 159 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); |
| 160 if (entry) { | 160 if (entry) { |
| 161 hs->UpdateWithPageEndTime(tab, entry->GetUniqueID(), tab->GetURL(), | 161 hs->UpdateWithPageEndTime(tab, entry->GetUniqueID(), tab->GetURL(), |
| 162 base::Time::Now()); | 162 base::Time::Now()); |
| 163 } | 163 } |
| 164 hs->ClearCachedDataForContextID(tab); | 164 hs->ClearCachedDataForContextID(tab); |
| 165 } | 165 } |
| 166 } | 166 } |
| OLD | NEW |