| 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.
|
| + if (content::IsBrowserSideNavigationEnabled())
|
| + return;
|
| +
|
| + if (search::IsNTPURL(url, profile())) {
|
| + // 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())
|
| + return;
|
| +
|
| if (!navigation_handle->IsInMainFrame() || navigation_handle->IsSamePage())
|
| return;
|
|
|
|
|