Merge pull request #10590 from brave/default_search_provider_sk

Updated default search providers in KR
This commit is contained in:
Simon Hong
2023-01-24 20:52:59 +09:00
committed by GitHub
20 changed files with 131 additions and 34 deletions
+10
View File
@@ -44,6 +44,7 @@ brave_java_resources = [
"java/res/drawable-hdpi/coin_stack.png",
"java/res/drawable-hdpi/coins.png",
"java/res/drawable-hdpi/copy_paste.png",
"java/res/drawable-hdpi/daum.png",
"java/res/drawable-hdpi/down_arrow.png",
"java/res/drawable-hdpi/ecosia.png",
"java/res/drawable-hdpi/group.png",
@@ -66,6 +67,7 @@ brave_java_resources = [
"java/res/drawable-hdpi/incognito_splash.png",
"java/res/drawable-hdpi/location_bar_incognito_badge.png",
"java/res/drawable-hdpi/modern_location_bar.9.png",
"java/res/drawable-hdpi/naver.png",
"java/res/drawable-hdpi/omnibox_https_valid.png",
"java/res/drawable-hdpi/pending_tx_placeholder.png",
"java/res/drawable-hdpi/plus.png",
@@ -118,6 +120,7 @@ brave_java_resources = [
"java/res/drawable-mdpi/coin_stack.png",
"java/res/drawable-mdpi/coins.png",
"java/res/drawable-mdpi/copy_paste.png",
"java/res/drawable-mdpi/daum.png",
"java/res/drawable-mdpi/down_arrow.png",
"java/res/drawable-mdpi/ecosia.png",
"java/res/drawable-mdpi/group.png",
@@ -140,6 +143,7 @@ brave_java_resources = [
"java/res/drawable-mdpi/incognito_splash.png",
"java/res/drawable-mdpi/location_bar_incognito_badge.png",
"java/res/drawable-mdpi/modern_location_bar.9.png",
"java/res/drawable-mdpi/naver.png",
"java/res/drawable-mdpi/omnibox_https_valid.png",
"java/res/drawable-mdpi/pending_tx_placeholder.png",
"java/res/drawable-mdpi/plus.png",
@@ -205,6 +209,7 @@ brave_java_resources = [
"java/res/drawable-xhdpi/coin_stack.png",
"java/res/drawable-xhdpi/coins.png",
"java/res/drawable-xhdpi/copy_paste.png",
"java/res/drawable-xhdpi/daum.png",
"java/res/drawable-xhdpi/down_arrow.png",
"java/res/drawable-xhdpi/ecosia.png",
"java/res/drawable-xhdpi/group.png",
@@ -227,6 +232,7 @@ brave_java_resources = [
"java/res/drawable-xhdpi/incognito_splash.png",
"java/res/drawable-xhdpi/location_bar_incognito_badge.png",
"java/res/drawable-xhdpi/modern_location_bar.9.png",
"java/res/drawable-xhdpi/naver.png",
"java/res/drawable-xhdpi/omnibox_https_valid.png",
"java/res/drawable-xhdpi/pending_tx_placeholder.png",
"java/res/drawable-xhdpi/plus.png",
@@ -279,6 +285,7 @@ brave_java_resources = [
"java/res/drawable-xxhdpi/coin_stack.png",
"java/res/drawable-xxhdpi/coins.png",
"java/res/drawable-xxhdpi/copy_paste.png",
"java/res/drawable-xxhdpi/daum.png",
"java/res/drawable-xxhdpi/ecosia.png",
"java/res/drawable-xxhdpi/group.png",
"java/res/drawable-xxhdpi/ic_ad_free_videos.png",
@@ -300,6 +307,7 @@ brave_java_resources = [
"java/res/drawable-xxhdpi/incognito_splash.png",
"java/res/drawable-xxhdpi/location_bar_incognito_badge.png",
"java/res/drawable-xxhdpi/modern_location_bar.9.png",
"java/res/drawable-xxhdpi/naver.png",
"java/res/drawable-xxhdpi/omnibox_https_valid.png",
"java/res/drawable-xxhdpi/pending_tx_placeholder.png",
"java/res/drawable-xxhdpi/plus.png",
@@ -351,6 +359,7 @@ brave_java_resources = [
"java/res/drawable-xxxhdpi/coin_stack.png",
"java/res/drawable-xxxhdpi/coins.png",
"java/res/drawable-xxxhdpi/copy_paste.png",
"java/res/drawable-xxxhdpi/daum.png",
"java/res/drawable-xxxhdpi/ecosia.png",
"java/res/drawable-xxxhdpi/group.png",
"java/res/drawable-xxxhdpi/ic_ad_free_videos.png",
@@ -371,6 +380,7 @@ brave_java_resources = [
"java/res/drawable-xxxhdpi/incognito_simple.png",
"java/res/drawable-xxxhdpi/incognito_splash.png",
"java/res/drawable-xxxhdpi/location_bar_incognito_badge.png",
"java/res/drawable-xxxhdpi/naver.png",
"java/res/drawable-xxxhdpi/omnibox_https_valid.png",
"java/res/drawable-xxxhdpi/pending_tx_placeholder.png",
"java/res/drawable-xxxhdpi/plus.png",
@@ -84,6 +84,8 @@ public class OnboardingPrefManager {
private static final String STARTPAGE = "Startpage";
public static final String YANDEX = "Yandex";
public static final String ECOSIA = "Ecosia";
public static final String DAUM = "Daum";
public static final String NAVER = "\ub124\uc774\ubc84";
private OnboardingPrefManager() {
mSharedPreferences = ContextUtils.getAppSharedPreferences();
@@ -273,6 +275,8 @@ public class OnboardingPrefManager {
put(STARTPAGE, SearchEngineEnum.STARTPAGE);
put(YANDEX, SearchEngineEnum.YANDEX);
put(ECOSIA, SearchEngineEnum.ECOSIA);
put(DAUM, SearchEngineEnum.DAUM);
put(NAVER, SearchEngineEnum.NAVER);
}
};
@@ -23,8 +23,9 @@ public enum SearchEngineEnum {
YANDEX(R.drawable.yandex, SearchEngineEnumConstants.SEARCH_YANDEX_ID, R.string.yandex_desc),
STARTPAGE(R.drawable.search_engine_startpage, SearchEngineEnumConstants.SEARCH_STARTPAGE_ID,
R.string.startpage_desc),
ECOSIA(R.drawable.ecosia, SearchEngineEnumConstants.SEARCH_ECOSIA_ID,
R.string.ecosia_desc);
ECOSIA(R.drawable.ecosia, SearchEngineEnumConstants.SEARCH_ECOSIA_ID, R.string.ecosia_desc),
DAUM(R.drawable.daum, SearchEngineEnumConstants.SEARCH_DAUM_ID, R.string.daum_desc),
NAVER(R.drawable.naver, SearchEngineEnumConstants.SEARCH_NAVER_ID, R.string.naver_desc);
private int icon;
private int id;
@@ -57,5 +58,7 @@ public enum SearchEngineEnum {
static final int SEARCH_STARTPAGE_ID = 5;
static final int SEARCH_YANDEX_ID = 6;
static final int SEARCH_ECOSIA_ID = 7;
static final int SEARCH_DAUM_ID = 8;
static final int SEARCH_NAVER_ID = 9;
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

@@ -43,6 +43,10 @@ void RecordSearchEngineP3A(const GURL& search_engine_url,
answer = SearchEngineP3A::kYandex;
} else if (type == SEARCH_ENGINE_ECOSIA) {
answer = SearchEngineP3A::kEcosia;
} else if (type == SEARCH_ENGINE_DAUM) {
answer = SearchEngineP3A::kDaum;
} else if (type == SEARCH_ENGINE_NAVER) {
answer = SearchEngineP3A::kNaver;
} else if (type == SEARCH_ENGINE_OTHER) {
if (base::EndsWith(search_engine_url.host(), "startpage.com",
base::CompareCase::INSENSITIVE_ASCII)) {
@@ -37,7 +37,9 @@ enum class SearchEngineP3A {
kYandex,
kEcosia,
kBrave,
kMaxValue = kBrave,
kDaum,
kNaver,
kMaxValue = kNaver,
};
// Note: append-only enumeration! Never remove any existing values, as this enum
@@ -1682,6 +1682,12 @@ Are you sure you want to do this?
<message name="IDS_ECOSIA_DESC" desc="Onboarding SE text">
Plants trees, based in Berlin
</message>
<message name="IDS_DAUM_DESC" desc="Onboarding SE text">
South Korean web portal &amp; search
</message>
<message name="IDS_NAVER_DESC" desc="Onboarding SE text">
South Korean web portal &amp; search
</message>
<message name="IDS_BRAVE_DESC" desc="Onboarding SE text">
Private, independent, user-first
</message>
@@ -12,7 +12,6 @@
#include "base/command_line.h"
#include "base/files/scoped_temp_dir.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "brave/components/search_engines/brave_prepopulated_engines.h"
#include "components/google/core/common/google_switches.h"
@@ -26,8 +25,6 @@
#include "components/sync_preferences/testing_pref_service_syncable.h"
#include "testing/gtest/include/gtest/gtest.h"
using base::ASCIIToUTF16;
namespace {
const char kCountryIDAtInstall[] = "countryid_at_install";
@@ -67,7 +64,7 @@ class BraveTemplateURLPrepopulateDataTest : public testing::Test {
TemplateURLPrepopulateData::kBraveCurrentDataVersion);
}
void CheckForCountry(char digit1, char digit2, const std::string& expected) {
void CheckForCountry(char digit1, char digit2, int prepopulate_id) {
prefs_.SetInteger(kCountryIDAtInstall, digit1 << 8 | digit2);
prefs_.SetInteger(prefs::kBraveDefaultSearchVersion,
TemplateURLPrepopulateData::kBraveCurrentDataVersion);
@@ -75,7 +72,7 @@ class BraveTemplateURLPrepopulateDataTest : public testing::Test {
std::vector<std::unique_ptr<TemplateURLData>> t_urls =
TemplateURLPrepopulateData::GetPrepopulatedEngines(&prefs_,
&default_index);
EXPECT_EQ(ASCIIToUTF16(expected), t_urls[default_index]->short_name());
EXPECT_EQ(prepopulate_id, t_urls[default_index]->prepopulate_id);
}
protected:
@@ -151,110 +148,115 @@ TEST_F(BraveTemplateURLPrepopulateDataTest, ProvidersFromPrepopulated) {
// Verifies default search provider for locale
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForArgentina) {
CheckForCountry('A', 'R', "Brave");
CheckForCountry('A', 'R', PREPOPULATED_ENGINE_ID_BRAVE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForIndia) {
CheckForCountry('I', 'N', "Brave");
CheckForCountry('I', 'N', PREPOPULATED_ENGINE_ID_BRAVE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForBrazil) {
CheckForCountry('B', 'R', "Brave");
CheckForCountry('B', 'R', PREPOPULATED_ENGINE_ID_BRAVE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForUSA) {
CheckForCountry('U', 'S', "Brave");
CheckForCountry('U', 'S', PREPOPULATED_ENGINE_ID_BRAVE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForGermany) {
CheckForCountry('D', 'E', "Brave");
CheckForCountry('D', 'E', PREPOPULATED_ENGINE_ID_BRAVE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForFrance) {
CheckForCountry('F', 'R', "Brave");
CheckForCountry('F', 'R', PREPOPULATED_ENGINE_ID_BRAVE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForGreatBritain) {
CheckForCountry('G', 'B', "Brave");
CheckForCountry('G', 'B', PREPOPULATED_ENGINE_ID_BRAVE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForCanada) {
CheckForCountry('C', 'A', "Brave");
CheckForCountry('C', 'A', PREPOPULATED_ENGINE_ID_BRAVE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForAustralia) {
CheckForCountry('A', 'U', "Google");
CheckForCountry('A', 'U', PREPOPULATED_ENGINE_ID_GOOGLE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForNewZealand) {
CheckForCountry('N', 'Z', "Google");
CheckForCountry('N', 'Z', PREPOPULATED_ENGINE_ID_GOOGLE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForIreland) {
CheckForCountry('I', 'E', "Google");
CheckForCountry('I', 'E', PREPOPULATED_ENGINE_ID_GOOGLE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForAustria) {
CheckForCountry('A', 'T', "Brave");
CheckForCountry('A', 'T', PREPOPULATED_ENGINE_ID_BRAVE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForSpain) {
CheckForCountry('E', 'S', "Brave");
CheckForCountry('E', 'S', PREPOPULATED_ENGINE_ID_BRAVE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest, DefaultSearchProvidersForMexico) {
CheckForCountry('M', 'X', "Brave");
CheckForCountry('M', 'X', PREPOPULATED_ENGINE_ID_BRAVE);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForRepublicOfArmenia) {
CheckForCountry('A', 'M', "Yandex");
CheckForCountry('A', 'M', PREPOPULATED_ENGINE_ID_YANDEX);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForRepublicOfAzerbaijan) {
CheckForCountry('A', 'Z', "Yandex");
CheckForCountry('A', 'Z', PREPOPULATED_ENGINE_ID_YANDEX);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForRepublicOfBelarus) {
CheckForCountry('B', 'Y', "Yandex");
CheckForCountry('B', 'Y', PREPOPULATED_ENGINE_ID_YANDEX);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForKyrgyzRepublic) {
CheckForCountry('K', 'G', "Yandex");
CheckForCountry('K', 'G', PREPOPULATED_ENGINE_ID_YANDEX);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForRepublicOfKazakhstan) {
CheckForCountry('K', 'Z', "Yandex");
CheckForCountry('K', 'Z', PREPOPULATED_ENGINE_ID_YANDEX);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForRepublicOfMoldova) {
CheckForCountry('M', 'D', "Yandex");
CheckForCountry('M', 'D', PREPOPULATED_ENGINE_ID_YANDEX);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForRussianFederation) {
CheckForCountry('R', 'U', "Yandex");
CheckForCountry('R', 'U', PREPOPULATED_ENGINE_ID_YANDEX);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForRepublicOfTajikistan) {
CheckForCountry('T', 'J', "Yandex");
CheckForCountry('T', 'J', PREPOPULATED_ENGINE_ID_YANDEX);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForTurkmenistan) {
CheckForCountry('T', 'M', "Yandex");
CheckForCountry('T', 'M', PREPOPULATED_ENGINE_ID_YANDEX);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForRepublicOfUzbekistan) {
CheckForCountry('U', 'Z', "Yandex");
CheckForCountry('U', 'Z', PREPOPULATED_ENGINE_ID_YANDEX);
}
TEST_F(BraveTemplateURLPrepopulateDataTest,
DefaultSearchProvidersForSouthKorea) {
CheckForCountry('K', 'R', PREPOPULATED_ENGINE_ID_NAVER);
}
@@ -81,6 +81,13 @@ const std::vector<BravePrepopulatedEngineID> brave_engines_AU_IE = {
PREPOPULATED_ENGINE_ID_ECOSIA,
};
const std::vector<BravePrepopulatedEngineID> brave_engines_KR = {
PREPOPULATED_ENGINE_ID_BRAVE,
PREPOPULATED_ENGINE_ID_NAVER,
PREPOPULATED_ENGINE_ID_DAUM,
PREPOPULATED_ENGINE_ID_GOOGLE,
};
const std::vector<BravePrepopulatedEngineID> brave_engines_NZ = {
PREPOPULATED_ENGINE_ID_BRAVE, PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE,
PREPOPULATED_ENGINE_ID_GOOGLE, PREPOPULATED_ENGINE_ID_QWANT,
@@ -127,6 +134,7 @@ const std::map<int, const std::vector<BravePrepopulatedEngineID>*>
&brave_engines_with_ecosia},
{country_codes::CountryCharsToCountryID('K', 'G'),
&brave_engines_with_yandex},
{country_codes::CountryCharsToCountryID('K', 'R'), &brave_engines_KR},
{country_codes::CountryCharsToCountryID('K', 'Z'),
&brave_engines_with_yandex},
{country_codes::CountryCharsToCountryID('L', 'U'),
@@ -396,8 +404,62 @@ BravePrepopulatedEngineID GetDefaultSearchEngine(int country_id, int version) {
{country_codes::CountryCharsToCountryID('I', 'N'),
PREPOPULATED_ENGINE_ID_BRAVE},
});
static constexpr auto content_v23 =
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},
{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},
{country_codes::CountryCharsToCountryID('A', 'R'),
PREPOPULATED_ENGINE_ID_BRAVE},
{country_codes::CountryCharsToCountryID('B', 'R'),
PREPOPULATED_ENGINE_ID_BRAVE},
{country_codes::CountryCharsToCountryID('I', 'N'),
PREPOPULATED_ENGINE_ID_BRAVE},
// Added values in this version bellow
{country_codes::CountryCharsToCountryID('K', 'R'),
PREPOPULATED_ENGINE_ID_NAVER},
});
if (version > 21) {
if (version > 22) {
auto* it = content_v23.find(country_id);
if (it == content_v23.end()) {
return default_v6;
}
return it->second;
} else if (version > 21) {
auto* it = content_v22.find(country_id);
if (it == content_v22.end()) {
return default_v6;
@@ -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 = 22;
const int kBraveCurrentDataVersion = 23;
// DO NOT CHANGE THIS ONE. Used for backfilling kBraveDefaultSearchVersion.
const int kBraveFirstTrackedDataVersion = 6;
@@ -25,6 +25,8 @@ const std::map<BravePrepopulatedEngineID, const PrepopulatedEngine*>
{PREPOPULATED_ENGINE_ID_GOOGLE, &google},
{PREPOPULATED_ENGINE_ID_YANDEX, &brave_yandex},
{PREPOPULATED_ENGINE_ID_BING, &brave_bing},
{PREPOPULATED_ENGINE_ID_NAVER, &naver},
{PREPOPULATED_ENGINE_ID_DAUM, &daum},
{PREPOPULATED_ENGINE_ID_DUCKDUCKGO, &duckduckgo},
{PREPOPULATED_ENGINE_ID_DUCKDUCKGO_DE, &duckduckgo_de},
{PREPOPULATED_ENGINE_ID_DUCKDUCKGO_AU_NZ_IE, &duckduckgo_au_nz_ie},
@@ -31,6 +31,8 @@ enum BravePrepopulatedEngineID : unsigned int {
PREPOPULATED_ENGINE_ID_GOOGLE = 1,
PREPOPULATED_ENGINE_ID_BING = 3,
PREPOPULATED_ENGINE_ID_YANDEX = 15,
PREPOPULATED_ENGINE_ID_NAVER = 67,
PREPOPULATED_ENGINE_ID_DAUM = 68,
PREPOPULATED_ENGINE_ID_ECOSIA = 101,
// These engine IDs are not defined in Chromium
BRAVE_PREPOPULATED_ENGINES_START = 500,