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

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: session_types comment 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..34f8be0ef219ba01b48737a2230549d8265f7c59 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.
sky 2012/12/07 16:29:25 Don't remove this.
Mathieu 2012/12/11 00:30:17 Done. Not sure what happened.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -49,10 +48,24 @@ ToolbarModelImpl::~ToolbarModelImpl() {
// ToolbarModelImpl Implementation.
string16 ToolbarModelImpl::GetText(
bool display_search_urls_as_search_terms) const {
+
+ NavigationEntry* entry;
akalin 2012/12/06 23:14:46 this still isn't fixed
Mathieu 2012/12/11 00:30:17 Done. Thanks.
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();
sky 2012/12/07 16:29:25 If we can build this on the fly do we need to pers
Mathieu 2012/12/11 00:30:17 We would like to restore the correct search terms
sky 2012/12/11 22:59:16 Ok, but that doesn't seem to indicate we need to p
Mathieu 2012/12/12 19:37:53 Well, as I mentioned there are special cases where
sky 2012/12/12 21:18:05 Forgive my pushing back, but I want to make sure w
Mathieu 2012/12/12 21:32:02 No problem, glad to discuss. I'll refer now to the
- if (!search_terms.empty())
+ if (!search_terms.empty()) {
+ if (entry)
+ entry->SetSearchTerms(search_terms);
sky 2012/12/07 16:29:25 This seems like the wrong place to do this. Should
Mathieu 2012/12/11 00:30:17 I agree that it's not necessarily elegant to put s
sky 2012/12/11 22:59:16 How about SearchTabHelper.
Mathieu 2012/12/12 19:37:53 Done. Refactored TryToExtractSearchTermsFromURL to
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