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

Side by Side Diff: chrome/browser/ui/search/search_tab_helper.cc

Issue 78443005: New Tab: fix tab title flickering. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean up change. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/search/search_tab_helper.h" 5 #include "chrome/browser/ui/search/search_tab_helper.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 void SearchTabHelper::ToggleVoiceSearch() { 215 void SearchTabHelper::ToggleVoiceSearch() {
216 ipc_router_.ToggleVoiceSearch(); 216 ipc_router_.ToggleVoiceSearch();
217 } 217 }
218 218
219 void SearchTabHelper::RenderViewCreated( 219 void SearchTabHelper::RenderViewCreated(
220 content::RenderViewHost* render_view_host) { 220 content::RenderViewHost* render_view_host) {
221 ipc_router_.SetPromoInformation(IsAppLauncherEnabled()); 221 ipc_router_.SetPromoInformation(IsAppLauncherEnabled());
222 } 222 }
223 223
224 void SearchTabHelper::NavigateToPendingEntry(
225 const GURL& url,
226 content::NavigationController::ReloadType /* reload_type */) {
227 // Set the title on any pending entry corresponding to the NTP. This prevents
228 // any flickering of the tab title.
229 if (chrome::IsNTPURL(url, profile())) {
Charlie Reis 2013/11/22 23:19:12 Is this just a sanity check, or is this called on
samarth 2013/11/25 15:32:13 Called on every navigation.
230 content::NavigationEntry* entry =
231 web_contents_->GetController().GetVisibleEntry();
232 if (entry)
233 entry->SetTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE));
234 }
235 }
236
224 void SearchTabHelper::DidNavigateMainFrame( 237 void SearchTabHelper::DidNavigateMainFrame(
225 const content::LoadCommittedDetails& details, 238 const content::LoadCommittedDetails& details,
226 const content::FrameNavigateParams& params) { 239 const content::FrameNavigateParams& params) {
227 if (IsCacheableNTP(web_contents_)) { 240 if (IsCacheableNTP(web_contents_)) {
228 if (details.http_status_code == 204 || details.http_status_code >= 400) { 241 if (details.http_status_code == 204 || details.http_status_code >= 400) {
229 RedirectToLocalNTP(); 242 RedirectToLocalNTP();
230 RecordCacheableNTPLoadHistogram(false); 243 RecordCacheableNTPLoadHistogram(false);
231 return; 244 return;
232 } 245 }
233 RecordCacheableNTPLoadHistogram(true); 246 RecordCacheableNTPLoadHistogram(true);
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 void SearchTabHelper::RedirectToLocalNTP() { 560 void SearchTabHelper::RedirectToLocalNTP() {
548 // Extra parentheses to declare a variable. 561 // Extra parentheses to declare a variable.
549 content::NavigationController::LoadURLParams load_params( 562 content::NavigationController::LoadURLParams load_params(
550 (GURL(chrome::kChromeSearchLocalNtpUrl))); 563 (GURL(chrome::kChromeSearchLocalNtpUrl)));
551 load_params.referrer = content::Referrer(); 564 load_params.referrer = content::Referrer();
552 load_params.transition_type = content::PAGE_TRANSITION_SERVER_REDIRECT; 565 load_params.transition_type = content::PAGE_TRANSITION_SERVER_REDIRECT;
553 // Don't push a history entry. 566 // Don't push a history entry.
554 load_params.should_replace_current_entry = true; 567 load_params.should_replace_current_entry = true;
555 web_contents_->GetController().LoadURLWithParams(load_params); 568 web_contents_->GetController().LoadURLWithParams(load_params);
556 } 569 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698