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

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

Issue 11876045: [Search] Store and recall search terms using NavigationEntry to improve search term extraction (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: addressed comments Created 7 years, 11 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 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 1d20fa01495539b225dd6be8e8abb57730a8a069..d8568434c1c2132c64113e891613d41e6b7ab904 100644
--- a/chrome/browser/ui/toolbar/toolbar_model_impl.cc
+++ b/chrome/browser/ui/toolbar/toolbar_model_impl.cc
@@ -8,6 +8,7 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/autocomplete/autocomplete_input.h"
#include "chrome/browser/google/google_util.h"
+#include "chrome/browser/instant/instant_controller.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url.h"
@@ -72,6 +73,17 @@ ToolbarModelImpl::~ToolbarModelImpl() {
string16 ToolbarModelImpl::GetText(
bool display_search_urls_as_search_terms) const {
if (display_search_urls_as_search_terms) {
+ // If search terms were set explicitly on the NavigationEntry, use those.
samarth 2013/01/17 17:40:45 Factor this out into a GetSearchTermsFromNavigatio
Mathieu 2013/01/18 18:38:05 Done.
+ NavigationController* controller = GetNavigationController();
+ if (controller) {
+ NavigationEntry* entry = controller->GetVisibleEntry();
+ if (entry) {
+ string16 out_value;
+ if (entry->GetExtraData(std::string(InstantController::kSearchTermsKey),
+ &out_value))
+ return out_value;
+ }
+ }
string16 search_terms = TryToExtractSearchTermsFromURL();
if (!search_terms.empty())
return search_terms;

Powered by Google App Engine
This is Rietveld 408576698