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

Unified Diff: components/search_engines/template_url_service.cc

Issue 2367373003: [Android] Allow setting recently visited search engines as default search engine (Closed)
Patch Set: Update based on Dan's new comments. Created 4 years, 1 month 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: components/search_engines/template_url_service.cc
diff --git a/components/search_engines/template_url_service.cc b/components/search_engines/template_url_service.cc
index ee12247b7e05e9ee6eb700c5464e914503b57d10..56ec6a55ba74fbd2b7135b78aebca554a59c55fd 100644
--- a/components/search_engines/template_url_service.cc
+++ b/components/search_engines/template_url_service.cc
@@ -413,6 +413,10 @@ void TemplateURLService::AddMatchingDomainKeywords(
matches);
}
+bool TemplateURLService::IsInDefaultList(const TemplateURL* t_url) {
+ return t_url->prepopulate_id() > 0 || t_url->created_by_policy();
+}
+
TemplateURL* TemplateURLService::GetTemplateURLForKeyword(
const base::string16& keyword) {
KeywordToTURLAndMeaningfulLength::const_iterator elem(
@@ -1642,7 +1646,7 @@ bool TemplateURLService::CanAddAutogeneratedKeywordForHost(
}
bool TemplateURLService::CanReplace(const TemplateURL* t_url) {
- return (t_url != default_search_provider_ && !t_url->show_in_default_list() &&
+ return (t_url != default_search_provider_ && !IsInDefaultList(t_url) &&
t_url->safe_for_autoreplace());
}

Powered by Google App Engine
This is Rietveld 408576698