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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 const content::LoadCommittedDetails& details, | 92 const content::LoadCommittedDetails& details, |
93 const content::FrameNavigateParams& params) { | 93 const content::FrameNavigateParams& params) { |
94 // Update history. Note that this needs to happen after the entry is complete, | 94 // Update history. Note that this needs to happen after the entry is complete, |
95 // which WillNavigate[Main,Sub]Frame will do before this function is called. | 95 // which WillNavigate[Main,Sub]Frame will do before this function is called. |
96 if (!params.should_update_history) | 96 if (!params.should_update_history) |
97 return; | 97 return; |
98 | 98 |
99 // Most of the time, the displayURL matches the loaded URL, but for about: | 99 // Most of the time, the displayURL matches the loaded URL, but for about: |
100 // URLs, we use a data: URL as the real value. We actually want to save the | 100 // URLs, we use a data: URL as the real value. We actually want to save the |
101 // about: URL to the history db and keep the data: URL hidden. This is what | 101 // about: URL to the history db and keep the data: URL hidden. This is what |
102 // the TabContents' URL getter does. | 102 // the WebContents' URL getter does. |
103 scoped_refptr<history::HistoryAddPageArgs> add_page_args( | 103 scoped_refptr<history::HistoryAddPageArgs> add_page_args( |
104 CreateHistoryAddPageArgs(web_contents()->GetURL(), details, params)); | 104 CreateHistoryAddPageArgs(web_contents()->GetURL(), details, params)); |
105 if (!web_contents()->GetDelegate() || | 105 if (!web_contents()->GetDelegate() || |
106 !web_contents()->GetDelegate()->ShouldAddNavigationToHistory( | 106 !web_contents()->GetDelegate()->ShouldAddNavigationToHistory( |
107 *add_page_args, details.type)) | 107 *add_page_args, details.type)) |
108 return; | 108 return; |
109 | 109 |
110 UpdateHistoryForNavigation(add_page_args); | 110 UpdateHistoryForNavigation(add_page_args); |
111 } | 111 } |
112 | 112 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 HistoryService* hs = profile->GetHistoryService(Profile::IMPLICIT_ACCESS); | 183 HistoryService* hs = profile->GetHistoryService(Profile::IMPLICIT_ACCESS); |
184 if (hs) { | 184 if (hs) { |
185 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); | 185 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); |
186 if (entry) { | 186 if (entry) { |
187 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(), | 187 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(), |
188 base::Time::Now()); | 188 base::Time::Now()); |
189 } | 189 } |
190 } | 190 } |
191 } | 191 } |
OLD | NEW |