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 "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 history::HistoryAddPageArgs | 62 history::HistoryAddPageArgs |
63 HistoryTabHelper::CreateHistoryAddPageArgs( | 63 HistoryTabHelper::CreateHistoryAddPageArgs( |
64 const GURL& virtual_url, | 64 const GURL& virtual_url, |
65 base::Time timestamp, | 65 base::Time timestamp, |
66 bool did_replace_entry, | 66 bool did_replace_entry, |
67 int nav_entry_id, | 67 int nav_entry_id, |
68 const content::FrameNavigateParams& params) { | 68 const content::FrameNavigateParams& params) { |
69 // Clicks on content suggestions on the NTP should not contribute to the | 69 // Clicks on content suggestions on the NTP should not contribute to the |
70 // Most Visited tiles in the NTP. | 70 // Most Visited tiles in the NTP. |
71 const bool consider_for_ntp_most_visited = | 71 const bool consider_for_ntp_most_visited = |
72 params.referrer.url != GURL(kChromeContentSuggestionsReferrer); | 72 params.referrer.url != kChromeContentSuggestionsReferrer; |
73 | 73 |
74 history::HistoryAddPageArgs add_page_args( | 74 history::HistoryAddPageArgs add_page_args( |
75 params.url, timestamp, history::ContextIDForWebContents(web_contents()), | 75 params.url, timestamp, history::ContextIDForWebContents(web_contents()), |
76 nav_entry_id, params.referrer.url, params.redirects, params.transition, | 76 nav_entry_id, params.referrer.url, params.redirects, params.transition, |
77 history::SOURCE_BROWSED, did_replace_entry, | 77 history::SOURCE_BROWSED, did_replace_entry, |
78 consider_for_ntp_most_visited); | 78 consider_for_ntp_most_visited); |
79 if (ui::PageTransitionIsMainFrame(params.transition) && | 79 if (ui::PageTransitionIsMainFrame(params.transition) && |
80 virtual_url != params.url) { | 80 virtual_url != params.url) { |
81 // Hack on the "virtual" URL so that it will appear in history. For some | 81 // Hack on the "virtual" URL so that it will appear in history. For some |
82 // types of URLs, we will display a magic URL that is different from where | 82 // types of URLs, we will display a magic URL that is different from where |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 if (hs) { | 172 if (hs) { |
173 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); | 173 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); |
174 history::ContextID context_id = history::ContextIDForWebContents(tab); | 174 history::ContextID context_id = history::ContextIDForWebContents(tab); |
175 if (entry) { | 175 if (entry) { |
176 hs->UpdateWithPageEndTime(context_id, entry->GetUniqueID(), tab->GetURL(), | 176 hs->UpdateWithPageEndTime(context_id, entry->GetUniqueID(), tab->GetURL(), |
177 base::Time::Now()); | 177 base::Time::Now()); |
178 } | 178 } |
179 hs->ClearCachedDataForContextID(context_id); | 179 hs->ClearCachedDataForContextID(context_id); |
180 } | 180 } |
181 } | 181 } |
OLD | NEW |