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

Unified Diff: chrome/browser/ui/browser_navigator.cc

Issue 78443005: New Tab: fix tab title flickering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698