Index: chrome/browser/ui/toolbar/toolbar_model.cc |
diff --git a/chrome/browser/ui/toolbar/toolbar_model.cc b/chrome/browser/ui/toolbar/toolbar_model.cc |
index c37d46177f3efcd8a82357b79e520873a33911e5..3a6864f758cf45f2841542cf0c2e3f16a07c0f63 100644 |
--- a/chrome/browser/ui/toolbar/toolbar_model.cc |
+++ b/chrome/browser/ui/toolbar/toolbar_model.cc |
@@ -6,9 +6,11 @@ |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/autocomplete/autocomplete_input.h" |
-#include "chrome/browser/google/google_util.h" |
#include "chrome/browser/prefs/pref_service.h" |
#include "chrome/browser/profiles/profile.h" |
+#include "chrome/browser/search_engines/template_url.h" |
+#include "chrome/browser/search_engines/template_url_service.h" |
+#include "chrome/browser/search_engines/template_url_service_factory.h" |
#include "chrome/browser/ssl/ssl_error_info.h" |
#include "chrome/browser/ui/search/search.h" |
#include "chrome/browser/ui/toolbar/toolbar_model_delegate.h" |
@@ -198,14 +200,25 @@ NavigationController* ToolbarModel::GetNavigationController() const { |
string16 ToolbarModel::TryToExtractSearchTermsFromURL(const GURL& url) const { |
Profile* profile = GetProfile(); |
- if (profile && |
- chrome::search::IsInstantExtendedAPIEnabled(profile) && |
- google_util::IsInstantExtendedAPIGoogleSearchUrl(url.spec())) { |
- // TODO(dominich): http://crbug.com/135106 - Replace this with whatever the |
- // final solution is as per http://crbug.com/139176. |
- return google_util::GetSearchTermsFromGoogleSearchURL(url.spec()); |
- } |
- return string16(); |
+ |
+ string16 result; |
Peter Kasting
2012/10/02 21:47:59
Nit: Declare this at the very bottom and return st
beaudoin
2012/10/03 22:46:52
Done.
|
+ |
+ // Ensure instant extended API is enabled. |
+ if (!profile || !chrome::search::IsInstantExtendedAPIEnabled(profile)) |
+ return result; |
+ |
+ TemplateURLService* template_url_service = |
+ TemplateURLServiceFactory::GetForProfile(profile); |
+ |
+ if (!template_url_service) |
Peter Kasting
2012/10/02 21:47:59
Can this ever be NULL?
beaudoin
2012/10/03 22:46:52
Upon checking, it is created if it does not alread
|
+ return result; |
+ |
+ TemplateURL *template_url = template_url_service->GetDefaultSearchProvider(); |
+ if (!template_url) |
+ return result; |
+ |
+ template_url->ExtractSearchTermsFromURL(url, &result); |
+ return result; |
} |
Profile* ToolbarModel::GetProfile() const { |