mirror of
https://abf.rosa.ru/djam/chromium-browser-stable-test.git
synced 2025-02-24 18:12:47 +00:00
227 lines
12 KiB
Diff
227 lines
12 KiB
Diff
From 27630293baa498cdc49748e16974108e5369282c Mon Sep 17 00:00:00 2001
|
|
From: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
|
|
Date: Sun, 29 May 2022 22:31:21 +0300
|
|
Subject: [PATCH 2/5] Yandex as default search engine
|
|
|
|
Unfortunately, Google has commercially gone away from Russia, where most users of ROSA Linux are located.
|
|
Quality of google.ru search results seems to be degradating a bit.
|
|
|
|
I understand that Google develops Chromium, and so it would be fair if they got some money from adverstisment,
|
|
but, firstly, they have themselves stopped all ads in Russia,
|
|
secondly, influnce of Google is a bad thing because they have to take part in the information war.
|
|
|
|
The patch "Functional new tab page with non-Google search engines" makes chrome://new-tab-page work.
|
|
Yandex's URL which is patched here does not allow to add new items in to the quick access list
|
|
and shows advertisment of the proprietary Yandex browser. I do not want users to install it.
|
|
|
|
A simpler solution would be changing chromium-default-config.json like
|
|
https://os.mos.ru/git/MOS/mos-panel-desktop/src/0f02deea4f7da5ee186433cc71a7ba0193a8f52d/kometa-std-desktop-1.1/chromium.json
|
|
but it would make Yandex.ru be the default even for not Russian users.
|
|
|
|
Yandex suggested ROSA to add ROSA's partner ID, also adding it.
|
|
---
|
|
.../search_engines/prepopulated_engines.json | 21 +++++++-------
|
|
.../search_engines/search_terms_data.cc | 2 +-
|
|
.../template_url_prepopulate_data.cc | 28 ++++++++++++-------
|
|
3 files changed, 30 insertions(+), 21 deletions(-)
|
|
|
|
--- a/components/search_engines/prepopulated_engines.json 2023-10-11 01:22:02.550145900 +0000
|
|
+++ b/components/search_engines/prepopulated_engines.json 2023-10-17 08:24:01.259057801 +0000
|
|
@@ -556,11 +556,11 @@
|
|
"keyword": "yandex.by",
|
|
"favicon_url": "https://yastatic.net/lego/_/pDu9OWAQKB0s2J9IojKpiS_Eho.ico",
|
|
"logo_url": "https://storage.ape.yandex.net/get/browser/Doodles/yandex/drawable-xxhdpi/yandex.png",
|
|
- "search_url": "https://yandex.by/{yandex:searchPath}?text={searchTerms}",
|
|
+ "search_url": "https://yandex.by/{yandex:searchPath}?text={searchTerms}&from=rosa&{yandex:referralID}",
|
|
"suggest_url": "https://suggest.yandex.by/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}",
|
|
"image_url": "https://yandex.by/images/search/?rpt=imageview",
|
|
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
|
|
- "new_tab_url": "https://www.yandex.by/chrome/newtab",
|
|
+ "new_tab_url": "chrome://new-tab-page",
|
|
"type": "SEARCH_ENGINE_YANDEX",
|
|
"id": 15
|
|
},
|
|
@@ -569,10 +569,11 @@
|
|
"name": "Yandex",
|
|
"keyword": "yandex.com",
|
|
"favicon_url": "https://yastatic.net/lego/_/rBTjd6UOPk5913OSn5ZQVYMTQWQ.ico",
|
|
- "search_url": "https://yandex.com/search/?text={searchTerms}&from=os&clid=1836588",
|
|
+ "search_url": "https://yandex.com/search/?text={searchTerms}&from=rosa&{yandex:referralID}",
|
|
"suggest_url": "https://suggest.yandex.com/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}&uil=en&v=3&sn=5",
|
|
"image_url": "https://yandex.com/images/search?rpt=imageview",
|
|
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
|
|
+ "new_tab_url": "chrome://new-tab-page",
|
|
"type": "SEARCH_ENGINE_YANDEX",
|
|
"id": 15
|
|
},
|
|
@@ -582,11 +583,11 @@
|
|
"keyword": "yandex.kz",
|
|
"favicon_url": "https://yastatic.net/lego/_/pDu9OWAQKB0s2J9IojKpiS_Eho.ico",
|
|
"logo_url": "https://storage.ape.yandex.net/get/browser/Doodles/yandex/drawable-xxhdpi/yandex.png",
|
|
- "search_url": "https://yandex.kz/{yandex:searchPath}?text={searchTerms}",
|
|
+ "search_url": "https://yandex.kz/{yandex:searchPath}?text={searchTerms}&from=rosa&{yandex:referralID}",
|
|
"suggest_url": "https://suggest.yandex.kz/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}",
|
|
"image_url": "https://yandex.kz/images/search/?rpt=imageview",
|
|
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
|
|
- "new_tab_url": "https://www.yandex.kz/chrome/newtab",
|
|
+ "new_tab_url": "chrome://new-tab-page",
|
|
"type": "SEARCH_ENGINE_YANDEX",
|
|
"id": 15
|
|
},
|
|
@@ -596,11 +597,11 @@
|
|
"keyword": "yandex.ru",
|
|
"favicon_url": "https://yastatic.net/lego/_/pDu9OWAQKB0s2J9IojKpiS_Eho.ico",
|
|
"logo_url": "https://storage.ape.yandex.net/get/browser/Doodles/yandex/drawable-xxhdpi/yandex.png",
|
|
- "search_url": "https://yandex.ru/{yandex:searchPath}?text={searchTerms}&{yandex:referralID}",
|
|
+ "search_url": "https://yandex.ru/{yandex:searchPath}?text={searchTerms}&from=rosa&{yandex:referralID}",
|
|
"suggest_url": "https://suggest.yandex.ru/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}",
|
|
"image_url": "https://yandex.ru/images/search/?rpt=imageview",
|
|
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
|
|
- "new_tab_url": "https://www.yandex.ru/chrome/newtab",
|
|
+ "new_tab_url": "chrome://new-tab-page",
|
|
"type": "SEARCH_ENGINE_YANDEX",
|
|
"id": 15
|
|
},
|
|
@@ -609,11 +610,11 @@
|
|
"name": "Yandex",
|
|
"keyword": "yandex.com.tr",
|
|
"favicon_url": "https://yastatic.net/lego/_/rBTjd6UOPk5913OSn5ZQVYMTQWQ.ico",
|
|
- "search_url": "https://www.yandex.com.tr/{yandex:searchPath}?text={searchTerms}",
|
|
+ "search_url": "https://www.yandex.com.tr/{yandex:searchPath}?text={searchTerms}&from=rosa&{yandex:referralID}",
|
|
"suggest_url": "https://suggest.yandex.com.tr/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}",
|
|
"image_url": "https://yandex.com.tr/gorsel/search?rpt=imageview",
|
|
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
|
|
- "new_tab_url": "https://www.yandex.com.tr/chrome/newtab",
|
|
+ "new_tab_url": "chrome://new-tab-page",
|
|
"type": "SEARCH_ENGINE_YANDEX",
|
|
"id": 15
|
|
},
|
|
@@ -623,7 +624,7 @@
|
|
"keyword": "yandex.ua",
|
|
"favicon_url": "https://yastatic.net/lego/_/pDu9OWAQKB0s2J9IojKpiS_Eho.ico",
|
|
"logo_url": "https://storage.ape.yandex.net/get/browser/Doodles/yandex/drawable-xxhdpi/yandex.png",
|
|
- "search_url": "https://yandex.ua/{yandex:searchPath}?text={searchTerms}",
|
|
+ "search_url": "https://yandex.ua/{yandex:searchPath}?text={searchTerms}&from=rosa&{yandex:referralID}",
|
|
"suggest_url": "https://suggest.yandex.ua/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}",
|
|
"image_url": "https://yandex.ua/images/search/?rpt=imageview",
|
|
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
|
|
--- a/components/search_engines/search_terms_data.cc 2023-10-11 01:22:02.550145900 +0000
|
|
+++ b/components/search_engines/search_terms_data.cc 2023-10-17 08:26:21.433286473 +0000
|
|
@@ -165,7 +165,7 @@
|
|
}
|
|
|
|
std::string SearchTermsData::GetYandexReferralID() const {
|
|
- return std::string();
|
|
+ return "2746754";
|
|
}
|
|
|
|
std::string SearchTermsData::GetMailRUReferralID() const {
|
|
diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc
|
|
index 315fa0b..8292ce1 100644
|
|
--- a/components/search_engines/template_url_prepopulate_data.cc
|
|
+++ b/components/search_engines/template_url_prepopulate_data.cc
|
|
@@ -56,6 +56,7 @@ struct EngineAndTier {
|
|
|
|
// Default (for countries with no better engine set)
|
|
constexpr EngineAndTier engines_default[] = {
|
|
+ {SearchEngineTier::kTopEngines, &yandex_com},
|
|
{SearchEngineTier::kTopEngines, &google},
|
|
{SearchEngineTier::kTopEngines, &bing},
|
|
{SearchEngineTier::kTopEngines, &yahoo},
|
|
@@ -65,11 +66,12 @@ constexpr EngineAndTier engines_default[] = {
|
|
// Engine selection by country ------------------------------------------------
|
|
// clang-format off
|
|
// United Arab Emirates
|
|
+// yandex.ru in Arab Emirates in top most popular engines... mda
|
|
constexpr EngineAndTier engines_AE[] = {
|
|
+ {SearchEngineTier::kTopEngines, &yandex_ru},
|
|
{SearchEngineTier::kTopEngines, &google},
|
|
{SearchEngineTier::kTopEngines, &bing},
|
|
{SearchEngineTier::kTopEngines, &yahoo},
|
|
- {SearchEngineTier::kTopEngines, &yandex_ru},
|
|
{SearchEngineTier::kTopEngines, &duckduckgo},
|
|
};
|
|
|
|
@@ -209,8 +211,8 @@ constexpr EngineAndTier engines_BR[] = {
|
|
|
|
// Belarus
|
|
constexpr EngineAndTier engines_BY[] = {
|
|
- {SearchEngineTier::kTopEngines, &google},
|
|
{SearchEngineTier::kTopEngines, &yandex_by},
|
|
+ {SearchEngineTier::kTopEngines, &google},
|
|
{SearchEngineTier::kTopEngines, &bing},
|
|
{SearchEngineTier::kTopEngines, &duckduckgo},
|
|
{SearchEngineTier::kTopEngines, &mail_ru},
|
|
@@ -597,9 +599,9 @@ constexpr EngineAndTier engines_IN[] = {
|
|
|
|
// Iraq
|
|
constexpr EngineAndTier engines_IQ[] = {
|
|
+ {SearchEngineTier::kTopEngines, &yandex_tr},
|
|
{SearchEngineTier::kTopEngines, &google},
|
|
{SearchEngineTier::kTopEngines, &bing},
|
|
- {SearchEngineTier::kTopEngines, &yandex_tr},
|
|
{SearchEngineTier::kTopEngines, &yahoo},
|
|
{SearchEngineTier::kTopEngines, &duckduckgo},
|
|
};
|
|
@@ -702,8 +704,8 @@ constexpr EngineAndTier engines_KW[] = {
|
|
|
|
// Kazakhstan
|
|
constexpr EngineAndTier engines_KZ[] = {
|
|
- {SearchEngineTier::kTopEngines, &google},
|
|
{SearchEngineTier::kTopEngines, &yandex_kz},
|
|
+ {SearchEngineTier::kTopEngines, &google},
|
|
{SearchEngineTier::kTopEngines, &bing},
|
|
{SearchEngineTier::kTopEngines, &mail_ru},
|
|
{SearchEngineTier::kTopEngines, &yahoo},
|
|
@@ -1043,15 +1045,18 @@ constexpr EngineAndTier engines_RO[] = {
|
|
};
|
|
|
|
// Serbia
|
|
+// yandex.ru in Serbia in top most popular search engines...
|
|
+// https://bugs.chromium.org/p/chromium/issues/detail?id=1330154#c9
|
|
constexpr EngineAndTier engines_RS[] = {
|
|
+ {SearchEngineTier::kTopEngines, &yandex_ru},
|
|
{SearchEngineTier::kTopEngines, &google},
|
|
{SearchEngineTier::kTopEngines, &bing},
|
|
{SearchEngineTier::kTopEngines, &yahoo},
|
|
- {SearchEngineTier::kTopEngines, &yandex_ru},
|
|
{SearchEngineTier::kTopEngines, &duckduckgo},
|
|
};
|
|
|
|
// Russia
|
|
+// keep yandex_ru on the first place
|
|
constexpr EngineAndTier engines_RU[] = {
|
|
{SearchEngineTier::kTopEngines, &yandex_ru},
|
|
{SearchEngineTier::kTopEngines, &google},
|
|
@@ -1172,8 +1177,8 @@ constexpr EngineAndTier engines_TN[] = {
|
|
|
|
// Turkey
|
|
constexpr EngineAndTier engines_TR[] = {
|
|
- {SearchEngineTier::kTopEngines, &google},
|
|
{SearchEngineTier::kTopEngines, &yandex_tr},
|
|
+ {SearchEngineTier::kTopEngines, &google},
|
|
{SearchEngineTier::kTopEngines, &yahoo_tr},
|
|
{SearchEngineTier::kTopEngines, &bing},
|
|
{SearchEngineTier::kTopEngines, &duckduckgo},
|
|
@@ -1774,12 +1779,15 @@ std::vector<std::unique_ptr<TemplateURLData>> GetPrepopulatedEngines(
|
|
}
|
|
}
|
|
}
|
|
- if (default_search_provider_index) {
|
|
- const auto itr =
|
|
- base::ranges::find(t_urls, google.id, &TemplateURLData::prepopulate_id);
|
|
- *default_search_provider_index =
|
|
- itr == t_urls.end() ? 0 : std::distance(t_urls.begin(), itr);
|
|
- }
|
|
+ /* Making yandex_ru be the first in "const PrepopulatedEngine* const engines_RU[]"
|
|
+ * makes it be the first item in chrome://settings/search,
|
|
+ * but Google is still chosen by default.
|
|
+ * Removed code calculated the distance between 0 and Google's position
|
|
+ * and assign that position to default_search_provider_index,
|
|
+ * so that Google still was the default search engine.
|
|
+ * Instead, just use the first search engine as the default one.
|
|
+ */
|
|
+ if (default_search_provider_index) *default_search_provider_index = 0;
|
|
return t_urls;
|
|
}
|
|
|