Skip to content

Commit

Permalink
Update search engine defaults for DE / AU / NZ / IE
Browse files Browse the repository at this point in the history
  • Loading branch information
bsclifton committed Jul 12, 2021
1 parent 5504b6d commit 9418a18
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,28 +156,10 @@ TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForUSA) {
CheckForCountry('U', 'S', "Google");
}

TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForGermany) {
CheckForCountry('D', 'E', "DuckDuckGo");
}

TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForFrance) {
CheckForCountry('F', 'R', "Qwant");
}

TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForAustralia) {
CheckForCountry('A', 'U', "DuckDuckGo");
}

TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForNewZealand) {
CheckForCountry('N', 'Z', "DuckDuckGo");
}

TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForIreland) {
CheckForCountry('I', 'E', "DuckDuckGo");
}

TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForRepublicOfArmenia) {
CheckForCountry('A', 'M', "Yandex");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,39 @@ BravePrepopulatedEngineID GetDefaultSearchEngine(int country_id, int version) {
{country_codes::CountryCharsToCountryID('U', 'Z'),
PREPOPULATED_ENGINE_ID_YANDEX},
});
if (version > 7) {
static const base::NoDestructor<base::flat_map<int,
BravePrepopulatedEngineID>>
content_v16({
{country_codes::CountryCharsToCountryID('A', 'M'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('A', 'Z'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('B', 'Y'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('F', 'R'),
PREPOPULATED_ENGINE_ID_QWANT},
{country_codes::CountryCharsToCountryID('K', 'G'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('K', 'Z'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('M', 'D'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('R', 'U'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('T', 'J'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('T', 'M'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('U', 'Z'),
PREPOPULATED_ENGINE_ID_YANDEX},
});
if (version > 15) {
auto it = content_v16->find(country_id);
if (it == content_v16->end()) {
return default_v6;
}
return it->second;
} else if (version > 7) {
auto it = content_v8->find(country_id);
if (it == content_v8->end()) {
return default_v6;
Expand Down
2 changes: 1 addition & 1 deletion components/search_engines/brave_prepopulated_engines.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace TemplateURLPrepopulateData {

// IMPORTANT! Make sure to bump this value if you make changes to the
// engines below or add/remove engines.
const int kBraveCurrentDataVersion = 15;
const int kBraveCurrentDataVersion = 16;
// DO NOT CHANGE THIS ONE. Used for backfilling kBraveDefaultSearchVersion.
const int kBraveFirstTrackedDataVersion = 6;

Expand Down

0 comments on commit 9418a18

Please sign in to comment.