Chromium Code Reviews| Index: chrome/browser/ui/search/search_tab_helper.cc |
| diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc |
| index 2b48edd3dfc691909cd76982da97e39224b44bfa..95f076d299e9f0d282becec36ebc254eb0bb1645 100644 |
| --- a/chrome/browser/ui/search/search_tab_helper.cc |
| +++ b/chrome/browser/ui/search/search_tab_helper.cc |
| @@ -45,6 +45,7 @@ |
| #include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/user_metrics.h" |
| #include "content/public/browser/web_contents.h" |
| +#include "content/public/common/browser_side_navigation_policy.h" |
| #include "content/public/common/referrer.h" |
| #include "google_apis/gaia/gaia_auth_util.h" |
| #include "net/base/net_errors.h" |
| @@ -216,8 +217,35 @@ void SearchTabHelper::OnTabDeactivated() { |
| ipc_router_.OnTabDeactivated(); |
| } |
| +void SearchTabHelper::DidStartNavigationToPendingEntry( |
| + const GURL& url, |
| + content::ReloadType reload_type) { |
| + // TODO(jam): delete this method once PlzNavigate is turned on by default. |
| + // When PlzNavigate is enabled, DidStartNavigation is called early enough such |
| + // that there's no flickering. However when PlzNavigate is disabled, |
| + // DidStartNavigation is called too late and "Untitled" shows up momentarily. |
| + // The fix is to override this deprecated callback for the non-PlzNavigate |
| + // case. |
|
Marc Treib
2017/01/20 09:26:47
Is there a bug you could reference here?
(I'm seei
jam
2017/01/20 15:11:35
When PlzNavigate is turned on, we will delete this
|
| + if (content::IsBrowserSideNavigationEnabled()) |
| + return; |
| + |
| + if (search::IsNTPURL(url, profile())) { |
|
Marc Treib
2017/01/20 09:26:47
Put this block into a new helper, so it doesn't ha
jam
2017/01/20 15:11:35
given that this is only 3 lines of code, I thought
|
| + // Set the title on any pending entry corresponding to the NTP. This |
| + // prevents any flickering of the tab title. |
| + content::NavigationEntry* entry = |
| + web_contents_->GetController().GetPendingEntry(); |
| + if (entry) { |
| + web_contents_->UpdateTitleForEntry( |
| + entry, l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
| + } |
| + } |
| +} |
| + |
| void SearchTabHelper::DidStartNavigation( |
| content::NavigationHandle* navigation_handle) { |
| + if (!content::IsBrowserSideNavigationEnabled()) |
|
Marc Treib
2017/01/20 09:26:47
Once the non-PlzNavigate hack above is gone, this
jam
2017/01/20 15:11:35
(same as first comment)
|
| + return; |
| + |
| if (!navigation_handle->IsInMainFrame() || navigation_handle->IsSamePage()) |
| return; |