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..ee9133604b7555dc54d36968f6bfb4a48800a443 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,29 @@ void LoadURLInContents(WebContents* target_contents, |
| params->browser_initiated_post_data; |
| } |
| target_contents->GetController().LoadURLWithParams(load_url_params); |
| + |
| + // For Instant Extended NTPs, add a transient entry and explicitly set the |
|
sky
2013/11/21 23:16:31
This seems like a total hack to me. Isn't there a
samarth
2013/11/21 23:20:58
Yeah. I tried setting the title on the pending en
Charlie Reis
2013/11/21 23:23:57
It's worth understanding why IsInitialNavigation i
samarth
2013/11/21 23:44:06
Ah ok, so the problem is that the check is IsIniti
samarth
2013/11/22 00:29:03
I implemented this in PS2. Let me know what you th
|
| + // title to "New Tab". |
| + // |
| + // 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( |
| + entry->GetURL(), |
| + Profile::FromBrowserContext(target_contents->GetBrowserContext()))) { |
| + content::NavigationEntry* transient = controller->CreateNavigationEntry( |
| + entry->GetURL(), |
| + entry->GetReferrer(), |
| + entry->GetTransitionType(), |
| + false, |
| + std::string(), |
| + target_contents->GetBrowserContext()); |
| + transient->SetTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
| + controller->SetTransientEntry(transient); |
| + } |
| } |
| // This class makes sure the Browser object held in |params| is made visible |