Skip to content

Commit

Permalink
Merge pull request #3680 from brave/pr3672_bsc-fix-incognito-search_0…
Browse files Browse the repository at this point in the history
….70.x

Have a list of fall-back engines to try for private window search (uplift to 0.70.x)
  • Loading branch information
bsclifton authored Oct 14, 2019
2 parents 5c7bb7d + c691598 commit 90e0303
Showing 1 changed file with 18 additions and 3 deletions.
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

0 comments on commit 90e0303

Please sign in to comment.