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

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

Issue 2949023002: [WIP] Fix history.replaceState() not propagating back favicons (Closed)
Patch Set: Created 3 years, 6 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 // TODO / DONOTSUBMIT(mastiz): if we really go with IsSameDocument, the
sky 2017/06/22 15:26:39 ?
mastiz 2017/06/22 20:31:09 Sorry scott, the "RFC" in the title was trying to
Charlie Reis 2017/06/27 19:10:06 I think japhet@ is probably the best person to ask
86 // parameters should be renamed.
87 navigation_handle->/*DidReplaceEntry() ?//*/ IsSameDocument()
88 ? base::Optional<GURL>(navigation_handle->GetPreviousURL())
89 : base::nullopt,
90 consider_for_ntp_most_visited);
86 if (ui::PageTransitionIsMainFrame(navigation_handle->GetPageTransition()) && 91 if (ui::PageTransitionIsMainFrame(navigation_handle->GetPageTransition()) &&
87 virtual_url != navigation_handle->GetURL()) { 92 virtual_url != navigation_handle->GetURL()) {
88 // Hack on the "virtual" URL so that it will appear in history. For some 93 // 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 94 // 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 95 // 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 96 // 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 97 // only applies to the main frame, as the virtual URL doesn't apply to
93 // sub-frames. 98 // sub-frames.
94 add_page_args.url = virtual_url; 99 add_page_args.url = virtual_url;
95 if (!add_page_args.redirects.empty()) 100 if (!add_page_args.redirects.empty())
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 if (hs) { 198 if (hs) {
194 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry(); 199 NavigationEntry* entry = tab->GetController().GetLastCommittedEntry();
195 history::ContextID context_id = history::ContextIDForWebContents(tab); 200 history::ContextID context_id = history::ContextIDForWebContents(tab);
196 if (entry) { 201 if (entry) {
197 hs->UpdateWithPageEndTime(context_id, entry->GetUniqueID(), tab->GetURL(), 202 hs->UpdateWithPageEndTime(context_id, entry->GetUniqueID(), tab->GetURL(),
198 base::Time::Now()); 203 base::Time::Now());
199 } 204 }
200 hs->ClearCachedDataForContextID(context_id); 205 hs->ClearCachedDataForContextID(context_id);
201 } 206 }
202 } 207 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698