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

Unified Diff: chrome/browser/search/search.cc

Issue 2816383002: Remove non-const version of GetDefaultSearchProvider() and make all callers call the const version (Closed)
Patch Set: Fix unit test (the model was already loaded) Created 3 years, 8 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/search/search.cc
diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc
index 3c64c75c3cfb8c701fe88c37238cdbd73cbe3aec..a3d0a8e3599d7c73579e5218d9f3ba9dad3b2785 100644
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -85,7 +85,7 @@ base::Feature kUseGoogleLocalNtp {
"UseGoogleLocalNtp", base::FEATURE_DISABLED_BY_DEFAULT
};
-TemplateURL* GetDefaultSearchProviderTemplateURL(Profile* profile) {
+const TemplateURL* GetDefaultSearchProviderTemplateURL(Profile* profile) {
if (profile) {
TemplateURLService* template_url_service =
TemplateURLServiceFactory::GetForProfile(profile);
@@ -141,7 +141,8 @@ bool IsInstantURL(const GURL& url, Profile* profile) {
if (new_tab_url.is_valid() && MatchesOriginAndPath(url, new_tab_url))
return true;
- TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile);
+ const TemplateURL* template_url =
+ GetDefaultSearchProviderTemplateURL(profile);
if (!template_url)
return false;
@@ -218,7 +219,8 @@ struct NewTabURLDetails {
if (command_line->HasSwitch(switches::kForceLocalNtp))
return NewTabURLDetails(local_url, NEW_TAB_URL_VALID);
- TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile);
+ const TemplateURL* template_url =
+ GetDefaultSearchProviderTemplateURL(profile);
if (!profile || !template_url)
return NewTabURLDetails(local_url, NEW_TAB_URL_BAD);
@@ -261,7 +263,8 @@ base::string16 ExtractSearchTermsFromURL(Profile* profile, const GURL& url) {
return prerenderer->get_last_query();
}
- TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile);
+ const TemplateURL* template_url =
+ GetDefaultSearchProviderTemplateURL(profile);
base::string16 search_terms;
if (template_url)
template_url->ExtractSearchTermsFromURL(
@@ -350,7 +353,8 @@ GURL GetInstantURL(Profile* profile, bool force_instant_results) {
if (!IsInstantExtendedAPIEnabled() || !IsSuggestPrefEnabled(profile))
return GURL();
- TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile);
+ const TemplateURL* template_url =
+ GetDefaultSearchProviderTemplateURL(profile);
if (!template_url)
return GURL();
@@ -380,7 +384,8 @@ GURL GetInstantURL(Profile* profile, bool force_instant_results) {
// Returns URLs associated with the default search engine for |profile|.
std::vector<GURL> GetSearchURLs(Profile* profile) {
std::vector<GURL> result;
- TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile);
+ const TemplateURL* template_url =
+ GetDefaultSearchProviderTemplateURL(profile);
if (!template_url)
return result;
for (const TemplateURLRef& ref : template_url->url_refs()) {

Powered by Google App Engine
This is Rietveld 408576698