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

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

Issue 2949023002: [WIP] Fix history.replaceState() not propagating back favicons (Closed)
Patch Set: Focus on history.replaceState() Created 3 years, 5 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 "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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 base::Time timestamp, 71 base::Time timestamp,
72 int nav_entry_id, 72 int nav_entry_id,
73 content::NavigationHandle* navigation_handle) { 73 content::NavigationHandle* navigation_handle) {
74 // Clicks on content suggestions on the NTP should not contribute to the 74 // Clicks on content suggestions on the NTP should not contribute to the
75 // Most Visited tiles in the NTP. 75 // Most Visited tiles in the NTP.
76 const bool consider_for_ntp_most_visited = 76 const bool consider_for_ntp_most_visited =
77 navigation_handle->GetReferrer().url != kChromeContentSuggestionsReferrer; 77 navigation_handle->GetReferrer().url != kChromeContentSuggestionsReferrer;
78 78
79 history::HistoryAddPageArgs add_page_args( 79 history::HistoryAddPageArgs add_page_args(
80 navigation_handle->GetURL(), timestamp, 80 navigation_handle->GetURL(), timestamp,
81 history::ContextIDForWebContents(web_contents()), 81 history::ContextIDForWebContents(web_contents()), nav_entry_id,
82 nav_entry_id, navigation_handle->GetReferrer().url, 82 navigation_handle->GetReferrer().url,
83 navigation_handle->GetRedirectChain(), 83 navigation_handle->GetRedirectChain(),
84 navigation_handle->GetPageTransition(), history::SOURCE_BROWSED, 84 navigation_handle->GetPageTransition(), history::SOURCE_BROWSED,
85 navigation_handle->DidReplaceEntry(), consider_for_ntp_most_visited); 85 navigation_handle->DidReplaceEntry()
86 ? base::Optional<GURL>(navigation_handle->GetPreviousURL())
87 : base::nullopt,
88 consider_for_ntp_most_visited);
86 if (ui::PageTransitionIsMainFrame(navigation_handle->GetPageTransition()) && 89 if (ui::PageTransitionIsMainFrame(navigation_handle->GetPageTransition()) &&
87 virtual_url != navigation_handle->GetURL()) { 90 virtual_url != navigation_handle->GetURL()) {
88 // Hack on the "virtual" URL so that it will appear in history. For some 91 // Hack on the "virtual" URL so that it will appear in history. For some
89 // types of URLs, we will display a magic URL that is different from where 92 // types of URLs, we will display a magic URL that is different from where
90 // the page is actually navigated. We want the user to see in history what 93 // the page is actually navigated. We want the user to see in history what
91 // they saw in the URL bar, so we add the virtual URL as a redirect. This 94 // they saw in the URL bar, so we add the virtual URL as a redirect. This
92 // only applies to the main frame, as the virtual URL doesn't apply to 95 // only applies to the main frame, as the virtual URL doesn't apply to
93 // sub-frames. 96 // sub-frames.
94 add_page_args.url = virtual_url; 97 add_page_args.url = virtual_url;
95 if (!add_page_args.redirects.empty()) 98 if (!add_page_args.redirects.empty())
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 if (hs) { 196 if (hs) {
194 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); 197 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry();
195 history::ContextID context_id = history::ContextIDForWebContents(tab); 198 history::ContextID context_id = history::ContextIDForWebContents(tab);
196 if (entry) { 199 if (entry) {
197 hs->UpdateWithPageEndTime(context_id, entry->GetUniqueID(), tab->GetURL(), 200 hs->UpdateWithPageEndTime(context_id, entry->GetUniqueID(), tab->GetURL(),
198 base::Time::Now()); 201 base::Time::Now());
199 } 202 }
200 hs->ClearCachedDataForContextID(context_id); 203 hs->ClearCachedDataForContextID(context_id);
201 } 204 }
202 } 205 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698