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

Unified Diff: components/search_engines/template_url_prepopulate_data.cc

Issue 2479113002: Make extensions DSE persistent in browser prefs (Closed)
Patch Set: Added DSE tests 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_prepopulate_data.cc
diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc
index a8e7fe51514b28e13d90ff06f0b93ed32311ccdc..5900c8819382abefbc0ecdfca6faa3b1f061e639 100644
--- a/components/search_engines/template_url_prepopulate_data.cc
+++ b/components/search_engines/template_url_prepopulate_data.cc
@@ -1037,6 +1037,19 @@ std::vector<std::unique_ptr<TemplateURLData>> GetPrepopulatedEngines(
return GetPrepopulationSetFromCountryID(GetCountryIDFromPrefs(prefs));
}
+// Find the prepopulated search engine with the given id.
+std::unique_ptr<TemplateURLData> GetPrepopulatedEngine(PrefService* prefs,
+ int prepopulated_id) {
+ size_t default_index;
+ std::vector<std::unique_ptr<TemplateURLData>> engines =
+ TemplateURLPrepopulateData::GetPrepopulatedEngines(prefs, &default_index);
+ for (auto& engine : engines) {
+ if (engine->prepopulate_id == prepopulated_id)
+ return std::move(engine);
+ }
+ return nullptr;
+}
+
#if defined(OS_ANDROID)
std::vector<std::unique_ptr<TemplateURLData>> GetLocalPrepopulatedEngines(
const std::string& locale,

Powered by Google App Engine
This is Rietveld 408576698