Skip to content

Commit

Permalink
Merge pull request #3672 from brave/bsc-fix-incognito-search
Browse files Browse the repository at this point in the history
Have a list of fall-back engines to try for private window search
  • Loading branch information
bsclifton authored Oct 11, 2019
2 parents 109a13b + eab3d1c commit 3ddddc9
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 3ddddc9

Please sign in to comment.