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

Side by Side Diff: chrome/browser/ui/toolbar/toolbar_model_impl.cc

Issue 11576044: Remove call to IsInstantExtendedAPIGoogleSearchUrl from ToolbarModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed browser tests 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h" 5 #include "chrome/browser/ui/toolbar/toolbar_model_impl.h"
6 6
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/autocomplete/autocomplete_input.h" 8 #include "chrome/browser/autocomplete/autocomplete_input.h"
9 #include "chrome/browser/google/google_util.h" 9 #include "chrome/browser/google/google_util.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 WebContents* current_tab = delegate_->GetActiveWebContents(); 210 WebContents* current_tab = delegate_->GetActiveWebContents();
211 return current_tab ? &current_tab->GetController() : NULL; 211 return current_tab ? &current_tab->GetController() : NULL;
212 } 212 }
213 213
214 string16 ToolbarModelImpl::TryToExtractSearchTermsFromURL() const { 214 string16 ToolbarModelImpl::TryToExtractSearchTermsFromURL() const {
215 const GURL& url = GetURL(); 215 const GURL& url = GetURL();
216 Profile* profile = GetProfile(); 216 Profile* profile = GetProfile();
217 217
218 // Ensure query extraction is enabled and query URL is HTTPS. 218 // Ensure query extraction is enabled and query URL is HTTPS.
219 if (!profile || !chrome::search::IsQueryExtractionEnabled(profile) || 219 if (!profile || !chrome::search::IsQueryExtractionEnabled(profile) ||
220 !url.SchemeIs(chrome::kHttpsScheme) || 220 !url.SchemeIs(chrome::kHttpsScheme))
221 !google_util::IsInstantExtendedAPIGoogleSearchUrl(url.spec()))
222 return string16(); 221 return string16();
223 222
224 TemplateURLService* template_url_service = 223 TemplateURLService* template_url_service =
225 TemplateURLServiceFactory::GetForProfile(profile); 224 TemplateURLServiceFactory::GetForProfile(profile);
226 225
227 TemplateURL *template_url = template_url_service->GetDefaultSearchProvider(); 226 TemplateURL* template_url = template_url_service->GetDefaultSearchProvider();
228 if (!template_url) 227 if (!template_url || !template_url->HasSearchTermsReplacementKey(url))
229 return string16(); 228 return string16();
230 229
231 string16 result; 230 string16 result;
232 template_url->ExtractSearchTermsFromURL(url, &result); 231 template_url->ExtractSearchTermsFromURL(url, &result);
233 return result; 232 return result;
234 } 233 }
235 234
236 Profile* ToolbarModelImpl::GetProfile() const { 235 Profile* ToolbarModelImpl::GetProfile() const {
237 NavigationController* navigation_controller = GetNavigationController(); 236 NavigationController* navigation_controller = GetNavigationController();
238 return navigation_controller ? 237 return navigation_controller ?
239 Profile::FromBrowserContext(navigation_controller->GetBrowserContext()) : 238 Profile::FromBrowserContext(navigation_controller->GetBrowserContext()) :
240 NULL; 239 NULL;
241 } 240 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698