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

Unified Diff: chrome/browser/ui/search/instant_loader.cc

Issue 17022009: Force set the new tab title in instant extended. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 months 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 | « chrome/browser/resources/local_ntp/local_ntp.js ('k') | chrome/browser/ui/search/search_tab_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/search/instant_loader.cc
diff --git a/chrome/browser/ui/search/instant_loader.cc b/chrome/browser/ui/search/instant_loader.cc
index 79d00311ee956bb3066e09dd3b120c2b2b7e4fd7..c50b7fbdc6ce0c10d99b7a8206f90aafb94484af 100644
--- a/chrome/browser/ui/search/instant_loader.cc
+++ b/chrome/browser/ui/search/instant_loader.cc
@@ -21,6 +21,8 @@
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents_view.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util.h"
namespace {
@@ -56,6 +58,17 @@ void InstantLoader::Load() {
contents_->GetController().LoadURL(
instant_url_, content::Referrer(),
content::PAGE_TRANSITION_GENERATED, kInstantHeader);
+
+ // Explicitly set the new tab title and virtual URL.
+ //
+ // This ensures that the title is set even before we get a title from the
+ // page, preventing a potential flicker of the URL, and also ensures that
+ // (unless overridden by the page) the new tab title matches the browser UI
+ // locale.
+ content::NavigationEntry* entry = contents_->GetController().GetActiveEntry();
+ if (entry)
+ entry->SetTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE));
+
contents_->WasHidden();
int staleness_timeout_ms = chrome::GetInstantLoaderStalenessTimeoutSec() *
« no previous file with comments | « chrome/browser/resources/local_ntp/local_ntp.js ('k') | chrome/browser/ui/search/search_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698