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

Unified Diff: chrome/browser/ui/search/search_tab_helper.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: fix 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/search/search_tab_helper.cc
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index 6b46fd73ec85d5d80e4576fbce15c79706d20139..d872214f7de079179de9011cd00df162d413373b 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -6,6 +6,8 @@
#include "chrome/browser/google/google_util.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/search_engines/template_url_service.h"
+#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/ui/search/search.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/navigation_controller.h"
@@ -99,6 +101,17 @@ void SearchTabHelper::Observe(
!is_initial_navigation_commit_);
}
is_initial_navigation_commit_ = false;
+
+ // Update the extracted search terms (if any) in the model.
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents()->GetBrowserContext());
+ TemplateURLService* template_url_service =
+ TemplateURLServiceFactory::GetForProfile(profile);
+ string16 search_terms =
+ template_url_service->TryToExtractSearchTermsFromURL(
+ committed_details->entry->GetURL());
+ if (!search_terms.empty())
+ committed_details->entry->SetSearchTerms(search_terms);
}
void SearchTabHelper::UpdateModelBasedOnURL(const GURL& url, bool animate) {

Powered by Google App Engine
This is Rietveld 408576698