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

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: More tests 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 bb09f298afd909169ccd03eb71e11a86dd4b224a..643e8a407c40e995d4b1a05e3684428d8f48b883 100644
--- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc
+++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc
@@ -52,9 +52,22 @@ string16 ToolbarModelImpl::GetText(
GURL url(GetURL());
if (display_search_urls_as_search_terms) {
+ NavigationEntry* entry;
+ 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(url);
- if (!search_terms.empty())
+ if (!search_terms.empty()) {
+ if (entry)
akalin 2012/12/05 19:40:27 bug! entry isn't always initialized
Mathieu 2012/12/05 20:42:16 Done. Thanks.
+ 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