You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
6.8 KiB
146 lines
6.8 KiB
From a3f478e7c8b93c6aad5db97f43560db46492c5ea Mon Sep 17 00:00:00 2001
|
|
From: tigro <arkadiy.sheyn@softline.com>
|
|
Date: Thu, 2 Nov 2023 18:55:06 +0300
|
|
Subject: [PATCH] Yandex as default search engine
|
|
|
|
---
|
|
.../search_engines/prepopulated_engines.json | 11 +++++----
|
|
.../template_url_prepopulate_data.cc | 24 +++++++++++--------
|
|
2 files changed, 20 insertions(+), 15 deletions(-)
|
|
|
|
diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json
|
|
index 8ab6a40d2e..eded2b55e1 100644
|
|
--- a/components/search_engines/prepopulated_engines.json
|
|
+++ b/components/search_engines/prepopulated_engines.json
|
|
@@ -639,7 +639,7 @@
|
|
"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
|
|
},
|
|
@@ -652,6 +652,7 @@
|
|
"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
|
|
},
|
|
@@ -665,7 +666,7 @@
|
|
"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
|
|
},
|
|
@@ -679,7 +680,7 @@
|
|
"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
|
|
},
|
|
@@ -692,7 +693,7 @@
|
|
"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
|
|
},
|
|
@@ -706,7 +707,7 @@
|
|
"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",
|
|
- "new_tab_url": "https://www.yandex.ua/chrome/newtab",
|
|
+ "new_tab_url": "chrome://new-tab-page",
|
|
"type": "SEARCH_ENGINE_YANDEX",
|
|
"id": 15
|
|
},
|
|
diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc
|
|
index 315fa0bc59..08952eec6d 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},
|
|
@@ -209,8 +210,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 +598,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 +703,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},
|
|
@@ -1172,8 +1173,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 +1775,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;
|
|
}
|
|
|
|
--
|
|
2.41.0
|
|
|