Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have a list of fall-back engines to try for private window search (uplift to 0.70.x) #3680

Merged
merged 1 commit into from
Oct 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions browser/search_engines/search_engine_provider_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,24 @@ SearchEngineProviderService::SearchEngineProviderService(
base::Bind(&SearchEngineProviderService::OnPreferenceChanged,
base::Unretained(this)));

auto data = TemplateURLPrepopulateData::GetPrepopulatedEngine(
otr_profile->GetPrefs(),
TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_DUCKDUCKGO);
std::vector<TemplateURLPrepopulateData::BravePrepopulatedEngineID>
alt_search_providers = {
TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_DUCKDUCKGO,
TemplateURLPrepopulateData::PREPOPULATED_ENGINE_ID_DUCKDUCKGO_DE,
TemplateURLPrepopulateData::
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE
};

std::unique_ptr<TemplateURLData> data;
for (const auto& id : alt_search_providers) {
data = TemplateURLPrepopulateData::GetPrepopulatedEngine(
otr_profile->GetPrefs(), id);
if (data)
break;
}

// There should ALWAYS be one entry
DCHECK(data);
alternative_search_engine_url_.reset(new TemplateURL(*data));
}

Expand Down