Chromium Code Reviews| Index: chrome/browser/ui/browser_navigator.cc |
| diff --git a/chrome/browser/ui/browser_navigator.cc b/chrome/browser/ui/browser_navigator.cc |
| index ed4626879e66d24f9ecf09775b73b4898ddcc1b7..e3e6e8f494837f51042b55c0ba7a768d20cc4597 100644 |
| --- a/chrome/browser/ui/browser_navigator.cc |
| +++ b/chrome/browser/ui/browser_navigator.cc |
| @@ -19,6 +19,7 @@ |
| #include "chrome/browser/prerender/prerender_manager.h" |
| #include "chrome/browser/prerender/prerender_manager_factory.h" |
| #include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/search/search.h" |
| #include "chrome/browser/tab_contents/tab_util.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_finder.h" |
| @@ -34,11 +35,14 @@ |
| #include "chrome/common/pref_names.h" |
| #include "chrome/common/url_constants.h" |
| #include "content/public/browser/browser_url_handler.h" |
| +#include "content/public/browser/navigation_entry.h" |
| #include "content/public/browser/notification_service.h" |
| #include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/web_contents_view.h" |
| #include "extensions/common/extension.h" |
| +#include "grit/generated_resources.h" |
| +#include "ui/base/l10n/l10n_util.h" |
| #if defined(USE_AURA) |
| #include "ui/aura/window.h" |
| @@ -268,6 +272,21 @@ void LoadURLInContents(WebContents* target_contents, |
| params->browser_initiated_post_data; |
| } |
| target_contents->GetController().LoadURLWithParams(load_url_params); |
| + |
| + // For Instant Extended NTPs, explicitly set the title to "New Tab" on the |
| + // pending entry. |
| + // |
| + // This ensures that the title is set even before we get a title from the |
| + // page, preventing a potential flicker of the URL or "Loading...", and also |
| + // ensures that (unless overridden by the page) the new tab title matches the |
| + // browser UI locale. |
| + content::NavigationController* controller = &target_contents->GetController(); |
| + content::NavigationEntry* entry = controller->GetVisibleEntry(); |
| + if (chrome::IsNTPURL( |
|
Charlie Reis
2013/11/22 18:54:18
Hmm, this call happens for almost every URL. (Soo
samarth
2013/11/22 20:03:19
Agreed, this doesn't seem ideal. I don't know wher
Charlie Reis
2013/11/22 20:33:47
That sounds perfect-- thanks.
samarth
2013/11/22 21:54:41
Done.
|
| + entry->GetURL(), |
| + Profile::FromBrowserContext(target_contents->GetBrowserContext()))) { |
| + entry->SetTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
| + } |
| } |
| // This class makes sure the Browser object held in |params| is made visible |