Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove Set default search engine screen for AT / ES / MX (uplift to 1.42.x) #14260

Merged
merged 1 commit into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <map>
#include <vector>

#include "base/containers/fixed_flat_map.h"
#include "base/containers/flat_map.h"
#include "base/no_destructor.h"
#include "base/stl_util.h"
Expand Down Expand Up @@ -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<int, BravePrepopulatedEngineID>({
{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;
Expand Down
2 changes: 1 addition & 1 deletion components/brave_welcome_ui/reducers/welcome_reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const welcomeReducer: Reducer<Welcome.State | undefined> = (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,
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 @@ -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;

Expand Down