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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 history::HistoryAddPageArgs | 54 history::HistoryAddPageArgs |
55 HistoryTabHelper::CreateHistoryAddPageArgs( | 55 HistoryTabHelper::CreateHistoryAddPageArgs( |
56 const GURL& virtual_url, | 56 const GURL& virtual_url, |
57 base::Time timestamp, | 57 base::Time timestamp, |
58 bool did_replace_entry, | 58 bool did_replace_entry, |
59 const content::FrameNavigateParams& params) { | 59 const content::FrameNavigateParams& params) { |
60 history::HistoryAddPageArgs add_page_args( | 60 history::HistoryAddPageArgs add_page_args( |
61 params.url, timestamp, web_contents(), params.page_id, | 61 params.url, timestamp, web_contents(), params.page_id, |
62 params.referrer.url, params.redirects, params.transition, | 62 params.referrer.url, params.redirects, params.transition, |
63 history::SOURCE_BROWSED, did_replace_entry); | 63 history::SOURCE_BROWSED, did_replace_entry); |
64 if (content::PageTransitionIsMainFrame(params.transition) && | 64 if (ui::PageTransitionIsMainFrame(params.transition) && |
65 virtual_url != params.url) { | 65 virtual_url != params.url) { |
66 // Hack on the "virtual" URL so that it will appear in history. For some | 66 // Hack on the "virtual" URL so that it will appear in history. For some |
67 // types of URLs, we will display a magic URL that is different from where | 67 // types of URLs, we will display a magic URL that is different from where |
68 // the page is actually navigated. We want the user to see in history what | 68 // the page is actually navigated. We want the user to see in history what |
69 // they saw in the URL bar, so we add the virtual URL as a redirect. This | 69 // they saw in the URL bar, so we add the virtual URL as a redirect. This |
70 // only applies to the main frame, as the virtual URL doesn't apply to | 70 // only applies to the main frame, as the virtual URL doesn't apply to |
71 // sub-frames. | 71 // sub-frames. |
72 add_page_args.url = virtual_url; | 72 add_page_args.url = virtual_url; |
73 if (!add_page_args.redirects.empty()) | 73 if (!add_page_args.redirects.empty()) |
74 add_page_args.redirects.back() = virtual_url; | 74 add_page_args.redirects.back() = virtual_url; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); | 153 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); |
154 if (hs) { | 154 if (hs) { |
155 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); | 155 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); |
156 if (entry) { | 156 if (entry) { |
157 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(), | 157 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(), |
158 base::Time::Now()); | 158 base::Time::Now()); |
159 } | 159 } |
160 hs->ClearCachedDataForContextID(tab); | 160 hs->ClearCachedDataForContextID(tab); |
161 } | 161 } |
162 } | 162 } |
OLD | NEW |