diff --git a/chromium_src/components/search_engines/brave_template_url_prepopulate_data_unittest.cc b/chromium_src/components/search_engines/brave_template_url_prepopulate_data_unittest.cc index 275a621f3cc1..91480ef1ca75 100644 --- a/chromium_src/components/search_engines/brave_template_url_prepopulate_data_unittest.cc +++ b/chromium_src/components/search_engines/brave_template_url_prepopulate_data_unittest.cc @@ -185,6 +185,18 @@ TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForIreland) { CheckForCountry('I', 'E', "Google"); } +TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForAustria) { + CheckForCountry('A', 'T', "Brave"); +} + +TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForSpain) { + CheckForCountry('E', 'S', "Brave"); +} + +TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForMexico) { + CheckForCountry('M', 'X', "Brave"); +} + TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForRepublicOfArmenia) { CheckForCountry('A', 'M', "Yandex"); diff --git a/chromium_src/components/search_engines/template_url_prepopulate_data.cc b/chromium_src/components/search_engines/template_url_prepopulate_data.cc index 4e075f30bf4b..46e80068924d 100644 --- a/chromium_src/components/search_engines/template_url_prepopulate_data.cc +++ b/chromium_src/components/search_engines/template_url_prepopulate_data.cc @@ -8,6 +8,7 @@ #include #include +#include "base/containers/fixed_flat_map.h" #include "base/containers/flat_map.h" #include "base/no_destructor.h" #include "base/stl_util.h" @@ -264,7 +265,53 @@ BravePrepopulatedEngineID GetDefaultSearchEngine(int country_id, int version) { PREPOPULATED_ENGINE_ID_YANDEX}, }); - if (version > 16) { + static constexpr auto content_v20 = + base::MakeFixedFlatMap({ + {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('C', 'A'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('D', 'E'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('F', 'R'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('G', 'B'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {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', 'S'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('U', 'Z'), + PREPOPULATED_ENGINE_ID_YANDEX}, + // Added values in this version bellow + {country_codes::CountryCharsToCountryID('A', 'T'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('E', 'S'), + PREPOPULATED_ENGINE_ID_BRAVE}, + {country_codes::CountryCharsToCountryID('M', 'X'), + PREPOPULATED_ENGINE_ID_BRAVE}, + }); + if (version > 19) { + auto* it = content_v20.find(country_id); + if (it == content_v20.end()) { + return default_v6; + } + return it->second; + } else if (version > 16) { auto it = content_v17->find(country_id); if (it == content_v17->end()) { return default_v6; diff --git a/components/brave_welcome_ui/reducers/welcome_reducer.ts b/components/brave_welcome_ui/reducers/welcome_reducer.ts index 11b3f626dac6..3c434ed830f2 100644 --- a/components/brave_welcome_ui/reducers/welcome_reducer.ts +++ b/components/brave_welcome_ui/reducers/welcome_reducer.ts @@ -45,7 +45,7 @@ const welcomeReducer: Reducer = (state: Welcome.State // Regions approved for Brave Search will skip search welcome card // Regions not approved show the card- but without Brave Search const braveSearchApprovedRegion: boolean = - ['US', 'CA', 'DE', 'FR', 'GB'].includes(loadTimeData.getString('countryString')) + ['AT', 'ES', 'MX', 'US', 'CA', 'DE', 'FR', 'GB'].includes(loadTimeData.getString('countryString')) state = { ...state, searchProviders: payload, diff --git a/components/search_engines/brave_prepopulated_engines.cc b/components/search_engines/brave_prepopulated_engines.cc index 7a7b12b19dd4..80037ddf62fc 100644 --- a/components/search_engines/brave_prepopulated_engines.cc +++ b/components/search_engines/brave_prepopulated_engines.cc @@ -13,7 +13,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 = 19; +const int kBraveCurrentDataVersion = 20; // DO NOT CHANGE THIS ONE. Used for backfilling kBraveDefaultSearchVersion. const int kBraveFirstTrackedDataVersion = 6;