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

Unified Diff: chrome/browser/ui/toolbar/toolbar_model_impl.cc

Issue 11415292: [Search] No longer reverting omnibox text on instant search (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: addressed comments Created 8 years 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
Index: chrome/browser/ui/toolbar/toolbar_model_impl.cc
diff --git a/chrome/browser/ui/toolbar/toolbar_model_impl.cc b/chrome/browser/ui/toolbar/toolbar_model_impl.cc
index 64a3716f5ea591a6d5c9b0e4a8fdadcac3c62dab..ba4ae9fb8eae60af51dd8a7f39961088210b4ef2 100644
--- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc
+++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc
@@ -1,4 +1,3 @@
-// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -49,10 +48,23 @@ ToolbarModelImpl::~ToolbarModelImpl() {
// ToolbarModelImpl Implementation.
string16 ToolbarModelImpl::GetText(
bool display_search_urls_as_search_terms) const {
+ NavigationEntry* entry;
if (display_search_urls_as_search_terms) {
+ const NavigationController* navigation_controller =
+ GetNavigationController();
+ if (navigation_controller) {
+ entry = navigation_controller->GetVisibleEntry();
+ if (entry && !entry->GetSearchTerms().empty()) {
+ // Entry has existing search terms.
+ return entry->GetSearchTerms();
+ }
+ }
string16 search_terms = TryToExtractSearchTermsFromURL();
- if (!search_terms.empty())
+ if (!search_terms.empty()) {
+ if (entry)
+ entry->SetSearchTerms(search_terms);
return search_terms;
+ }
}
std::string languages; // Empty if we don't have a |navigation_controller|.
Profile* profile = GetProfile();

Powered by Google App Engine
This is Rietveld 408576698