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 13, 2021
1 parent 87acd5b commit 7ba89f3
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForUSA) {
}

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

TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForFrance) {
Expand All @@ -166,16 +166,16 @@ TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForFrance) {

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

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

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

TEST_F(BraveTemplateURLPrepopulateDataTest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,66 +159,97 @@ const std::map<int, const std::vector<BravePrepopulatedEngineID>*>

// A versioned map tracking the singular default search engine per-country.
BravePrepopulatedEngineID GetDefaultSearchEngine(int country_id, int version) {
const BravePrepopulatedEngineID default_v6 =
PREPOPULATED_ENGINE_ID_GOOGLE;
static const base::NoDestructor<base::flat_map<int,
BravePrepopulatedEngineID>>
const BravePrepopulatedEngineID default_v6 = PREPOPULATED_ENGINE_ID_GOOGLE;
static const base::NoDestructor<
base::flat_map<int, BravePrepopulatedEngineID>>
content_v6({
{country_codes::CountryCharsToCountryID('A', 'U'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE},
{country_codes::CountryCharsToCountryID('F', 'R'),
PREPOPULATED_ENGINE_ID_QWANT},
{country_codes::CountryCharsToCountryID('D', 'E'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_DE},
{country_codes::CountryCharsToCountryID('I', 'E'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE},
{country_codes::CountryCharsToCountryID('N', 'Z'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE},
{country_codes::CountryCharsToCountryID('A', 'U'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE},
{country_codes::CountryCharsToCountryID('F', 'R'),
PREPOPULATED_ENGINE_ID_QWANT},
{country_codes::CountryCharsToCountryID('D', 'E'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_DE},
{country_codes::CountryCharsToCountryID('I', 'E'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE},
{country_codes::CountryCharsToCountryID('N', 'Z'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE},
});
static const base::NoDestructor<base::flat_map<int,
BravePrepopulatedEngineID>>
static const base::NoDestructor<
base::flat_map<int, BravePrepopulatedEngineID>>
content_v8({
{country_codes::CountryCharsToCountryID('A', 'M'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('A', 'Z'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('A', 'U'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE},
{country_codes::CountryCharsToCountryID('B', 'Y'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('D', 'E'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_DE},
{country_codes::CountryCharsToCountryID('F', 'R'),
PREPOPULATED_ENGINE_ID_QWANT},
{country_codes::CountryCharsToCountryID('I', 'E'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE},
{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('N', 'Z'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE},
{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},
{country_codes::CountryCharsToCountryID('A', 'M'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('A', 'Z'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('A', 'U'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE},
{country_codes::CountryCharsToCountryID('B', 'Y'),
PREPOPULATED_ENGINE_ID_YANDEX},
{country_codes::CountryCharsToCountryID('D', 'E'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_DE},
{country_codes::CountryCharsToCountryID('F', 'R'),
PREPOPULATED_ENGINE_ID_QWANT},
{country_codes::CountryCharsToCountryID('I', 'E'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE},
{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('N', 'Z'),
PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE},
{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},
});
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 > 7) {
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;
return default_v6;
}
return it->second;
} else {
auto it = content_v6->find(country_id);
if (it == content_v6->end()) {
return default_v6;
return default_v6;
}
return it->second;
}
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 7ba89f3

Please sign in to comment.