mirror of
https://abf.rosa.ru/djam/chromium-browser-stable-test.git
synced 2025-02-24 10:02:47 +00:00
201 lines
9.9 KiB
Diff
201 lines
9.9 KiB
Diff
From 8f8076ba8a12b1d47a063eb9926fe30b1cfcea69 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] 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 | 24 +++++++++++--------
|
|
3 files changed, 26 insertions(+), 21 deletions(-)
|
|
|
|
diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json
|
|
index b5e448c265..270ff3479d 100644
|
|
--- a/components/search_engines/prepopulated_engines.json
|
|
+++ b/components/search_engines/prepopulated_engines.json
|
|
@@ -554,11 +554,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
|
|
},
|
|
@@ -567,10 +567,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
|
|
},
|
|
@@ -580,11 +581,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
|
|
},
|
|
@@ -594,11 +595,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
|
|
},
|
|
@@ -607,11 +608,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
|
|
},
|
|
@@ -621,7 +622,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",
|
|
diff --git a/components/search_engines/search_terms_data.cc b/components/search_engines/search_terms_data.cc
|
|
index d4a02bc470..fd3f75d3a7 100644
|
|
--- a/components/search_engines/search_terms_data.cc
|
|
+++ b/components/search_engines/search_terms_data.cc
|
|
@@ -164,7 +164,7 @@ std::string SearchTermsData::GoogleImageSearchSource() const {
|
|
}
|
|
|
|
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 dbd10daed1..6c8db0aede 100644
|
|
--- a/components/search_engines/template_url_prepopulate_data.cc
|
|
+++ b/components/search_engines/template_url_prepopulate_data.cc
|
|
@@ -29,6 +29,7 @@ namespace {
|
|
|
|
// Default (for countries with no better engine set)
|
|
const PrepopulatedEngine* const engines_default[] = {
|
|
+ &yandex_com,
|
|
&google,
|
|
&bing,
|
|
&yahoo,
|
|
@@ -156,8 +157,8 @@ const PrepopulatedEngine* const engines_BR[] = {
|
|
|
|
// Belarus
|
|
const PrepopulatedEngine* const engines_BY[] = {
|
|
- &google,
|
|
&yandex_by,
|
|
+ &google,
|
|
&mail_ru,
|
|
&bing,
|
|
&duckduckgo,
|
|
@@ -435,10 +436,10 @@ const PrepopulatedEngine* const engines_IN[] = {
|
|
|
|
// Iraq
|
|
const PrepopulatedEngine* const engines_IQ[] = {
|
|
+ &yandex_tr,
|
|
&google,
|
|
&bing,
|
|
&yahoo,
|
|
- &yandex_tr,
|
|
&petal_search,
|
|
};
|
|
|
|
@@ -525,8 +526,8 @@ const PrepopulatedEngine* const engines_KW[] = {
|
|
|
|
// Kazakhstan
|
|
const PrepopulatedEngine* const engines_KZ[] = {
|
|
- &google,
|
|
&yandex_kz,
|
|
+ &google,
|
|
&mail_ru,
|
|
&bing,
|
|
&duckduckgo,
|
|
@@ -894,8 +895,8 @@ const PrepopulatedEngine* const engines_TN[] = {
|
|
|
|
// Turkey
|
|
const PrepopulatedEngine* const engines_TR[] = {
|
|
- &google,
|
|
&yandex_tr,
|
|
+ &google,
|
|
&yahoo_tr,
|
|
&bing,
|
|
&duckduckgo,
|
|
@@ -1381,12 +1382,15 @@ std::vector<std::unique_ptr<TemplateURLData>> GetPrepopulatedEngines(
|
|
t_urls = GetPrepopulationSetFromCountryID(
|
|
country_codes::GetCountryIDFromPrefs(prefs));
|
|
}
|
|
- 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;
|
|
}
|
|
|
|
--
|
|
2.35.2
|
|
|