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

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

Issue 22882007: Remove GetActiveEntry usage from chrome/browser/ui. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased on ToT. Created 7 years, 2 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 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // resources. Normally, we set the title when we begin a NTP load, but it can 281 // resources. Normally, we set the title when we begin a NTP load, but it can
282 // get reset in several places (like when you press Reload). This check 282 // get reset in several places (like when you press Reload). This check
283 // ensures that the title is properly set to the string defined by the Chrome 283 // ensures that the title is properly set to the string defined by the Chrome
284 // UI language (rather than the server language) in all cases. 284 // UI language (rather than the server language) in all cases.
285 // 285 //
286 // We only override the title when it's nonempty to allow the page to set the 286 // We only override the title when it's nonempty to allow the page to set the
287 // title if it really wants. An empty title means to use the default. There's 287 // title if it really wants. An empty title means to use the default. There's
288 // also a race condition between this code and the page's SetTitle call which 288 // also a race condition between this code and the page's SetTitle call which
289 // this rule avoids. 289 // this rule avoids.
290 content::NavigationEntry* entry = 290 content::NavigationEntry* entry =
291 web_contents_->GetController().GetActiveEntry(); 291 web_contents_->GetController().GetVisibleEntry();
292 if (entry && entry->GetTitle().empty() && 292 if (entry && entry->GetTitle().empty() &&
293 (entry->GetVirtualURL() == GURL(chrome::kChromeUINewTabURL) || 293 (entry->GetVirtualURL() == GURL(chrome::kChromeUINewTabURL) ||
294 chrome::NavEntryIsInstantNTP(web_contents_, entry))) { 294 chrome::NavEntryIsInstantNTP(web_contents_, entry))) {
295 entry->SetTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); 295 entry->SetTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE));
296 } 296 }
297 } 297 }
298 298
299 void SearchTabHelper::DidFailProvisionalLoad( 299 void SearchTabHelper::DidFailProvisionalLoad(
300 int64 /* frame_id */, 300 int64 /* frame_id */,
301 bool is_main_frame, 301 bool is_main_frame,
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 void SearchTabHelper::RedirectToLocalNTP() { 473 void SearchTabHelper::RedirectToLocalNTP() {
474 // Extra parentheses to declare a variable. 474 // Extra parentheses to declare a variable.
475 content::NavigationController::LoadURLParams load_params( 475 content::NavigationController::LoadURLParams load_params(
476 (GURL(chrome::kChromeSearchLocalNtpUrl))); 476 (GURL(chrome::kChromeSearchLocalNtpUrl)));
477 load_params.referrer = content::Referrer(); 477 load_params.referrer = content::Referrer();
478 load_params.transition_type = content::PAGE_TRANSITION_SERVER_REDIRECT; 478 load_params.transition_type = content::PAGE_TRANSITION_SERVER_REDIRECT;
479 // Don't push a history entry. 479 // Don't push a history entry.
480 load_params.should_replace_current_entry = true; 480 load_params.should_replace_current_entry = true;
481 web_contents_->GetController().LoadURLWithParams(load_params); 481 web_contents_->GetController().LoadURLWithParams(load_params);
482 } 482 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_page_unittest.cc ('k') | chrome/browser/ui/sync/tab_contents_synced_tab_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698