Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(722)

Side by Side Diff: chrome/browser/history/history_tab_helper.cc

Issue 556703004: Remove page id from FrameNavigateParams. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleaner Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void HistoryTabHelper::UpdateHistoryPageTitle(const NavigationEntry& entry) { 47 void HistoryTabHelper::UpdateHistoryPageTitle(const NavigationEntry& entry) {
48 HistoryService* hs = GetHistoryService(); 48 HistoryService* hs = GetHistoryService();
49 if (hs) 49 if (hs)
50 hs->SetPageTitle(entry.GetVirtualURL(), 50 hs->SetPageTitle(entry.GetVirtualURL(),
51 entry.GetTitleForDisplay(std::string())); 51 entry.GetTitleForDisplay(std::string()));
52 } 52 }
53 53
54 history::HistoryAddPageArgs 54 history::HistoryAddPageArgs
55 HistoryTabHelper::CreateHistoryAddPageArgs( 55 HistoryTabHelper::CreateHistoryAddPageArgs(
56 const GURL& virtual_url, 56 const GURL& virtual_url,
57 int32 page_id,
57 base::Time timestamp, 58 base::Time timestamp,
58 bool did_replace_entry, 59 bool did_replace_entry,
59 const content::FrameNavigateParams& params) { 60 const content::FrameNavigateParams& params) {
60 history::HistoryAddPageArgs add_page_args( 61 history::HistoryAddPageArgs add_page_args(
61 params.url, timestamp, web_contents(), params.page_id, 62 params.url, timestamp, web_contents(), page_id,
62 params.referrer.url, params.redirects, params.transition, 63 params.referrer.url, params.redirects, params.transition,
63 history::SOURCE_BROWSED, did_replace_entry); 64 history::SOURCE_BROWSED, did_replace_entry);
64 if (content::PageTransitionIsMainFrame(params.transition) && 65 if (content::PageTransitionIsMainFrame(params.transition) &&
65 virtual_url != params.url) { 66 virtual_url != params.url) {
66 // Hack on the "virtual" URL so that it will appear in history. For some 67 // 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 68 // 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 69 // 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 70 // 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 71 // only applies to the main frame, as the virtual URL doesn't apply to
71 // sub-frames. 72 // sub-frames.
(...skipping 18 matching lines...) Expand all
90 // which WillNavigate[Main,Sub]Frame will do before this function is called. 91 // which WillNavigate[Main,Sub]Frame will do before this function is called.
91 if (!params.should_update_history) 92 if (!params.should_update_history)
92 return; 93 return;
93 94
94 // Most of the time, the displayURL matches the loaded URL, but for about: 95 // Most of the time, the displayURL matches the loaded URL, but for about:
95 // URLs, we use a data: URL as the real value. We actually want to save the 96 // URLs, we use a data: URL as the real value. We actually want to save the
96 // about: URL to the history db and keep the data: URL hidden. This is what 97 // about: URL to the history db and keep the data: URL hidden. This is what
97 // the WebContents' URL getter does. 98 // the WebContents' URL getter does.
98 const history::HistoryAddPageArgs& add_page_args = 99 const history::HistoryAddPageArgs& add_page_args =
99 CreateHistoryAddPageArgs( 100 CreateHistoryAddPageArgs(
100 web_contents()->GetURL(), details.entry->GetTimestamp(), 101 web_contents()->GetURL(),
101 details.did_replace_entry, params); 102 details.entry->GetPageID(),
103 details.entry->GetTimestamp(),
104 details.did_replace_entry,
105 params);
102 106
103 prerender::PrerenderManager* prerender_manager = 107 prerender::PrerenderManager* prerender_manager =
104 prerender::PrerenderManagerFactory::GetForProfile( 108 prerender::PrerenderManagerFactory::GetForProfile(
105 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); 109 Profile::FromBrowserContext(web_contents()->GetBrowserContext()));
106 if (prerender_manager) { 110 if (prerender_manager) {
107 prerender::PrerenderContents* prerender_contents = 111 prerender::PrerenderContents* prerender_contents =
108 prerender_manager->GetPrerenderContents(web_contents()); 112 prerender_manager->GetPrerenderContents(web_contents());
109 if (prerender_contents) { 113 if (prerender_contents) {
110 prerender_contents->DidNavigate(add_page_args); 114 prerender_contents->DidNavigate(add_page_args);
111 return; 115 return;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS); 157 HistoryServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS);
154 if (hs) { 158 if (hs) {
155 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); 159 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry();
156 if (entry) { 160 if (entry) {
157 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(), 161 hs->UpdateWithPageEndTime(tab, entry->GetPageID(), tab->GetURL(),
158 base::Time::Now()); 162 base::Time::Now());
159 } 163 }
160 hs->ClearCachedDataForContextID(tab); 164 hs->ClearCachedDataForContextID(tab);
161 } 165 }
162 } 166 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698