@ -1,4 +1,4 @@
From 44a40a76c7f7a0a4effc7a99ce25825a3dbec0ab Mon Sep 17 00:00:00 2001
From a7f4daf245fae8cbee949584a3d10d141c221a5a Mon Sep 17 00:00:00 2001
From: tigro <tigro@msvsphere-os.ru>
Date: Thu, 19 Sep 2024 17:54:08 +0300
Subject: [PATCH] Added Yandex search bar as default on newtab and new-tab-page
@ -30,10 +30,10 @@ Subject: [PATCH] Added Yandex search bar as default on newtab and new-tab-page
23 files changed, 88 insertions(+), 33 deletions(-)
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index b597bcdb0c..4da22b920c 100644
index 47cecfd278..024a9dc2f6 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -7 741,10 +7741 ,8 @@ Keep your key file in a safe place. You will need it to create new versions of y
@@ -7 698,10 +7698 ,8 @@ Keep your key file in a safe place. You will need it to create new versions of y
<!-- NTP -->
<message name="IDS_GOOGLE_SEARCH_BOX_EMPTY_HINT_MD" desc="The text displayed in the fakebox (on the New Tab page) when it is empty, Google is the default search engine, and the Material Design UI is enabled.">
@ -45,10 +45,10 @@ index b597bcdb0c..4da22b920c 100644
<message name="IDS_GOOGLE_SEARCH_BOX_EMPTY_HINT_MULTIMODAL" desc="The text displayed in the multimodal searchbox when it is empty. It is meant to invite the user to add a text query to the existing image query in order to issue a 'multimodal' (image + text) query.">
Add to your search
diff --git a/chrome/app/resources/generated_resources_be.xtb b/chrome/app/resources/generated_resources_be.xtb
index ba534914bc..b79dc7658e 100644
index 03dc88027c..1f056930cd 100644
--- a/chrome/app/resources/generated_resources_be.xtb
+++ b/chrome/app/resources/generated_resources_be.xtb
@@ -9 737,7 +9737 ,7 @@
@@ -9 816,7 +9816 ,7 @@
<translation id="8048728378294435881">Стварайце рэзервовыя копіі сваіх даных, каб і х можна было выкарыстоўваць на іншых прыладах</translation>
<translation id="8048977114738515028">Стварыце ярлык на працоўным стале прылады, каб мець прамы доступ да гэтага профілю</translation>
<translation id="8049029041626250638">Падключыце клавіятуру а б о мыш. Калі вы выкарыстоўваеце прылады з Bluetooth, упэўніцеся, што яны гатовыя да спалучэння.</translation>
@ -57,7 +57,7 @@ index ba534914bc..b79dc7658e 100644
<translation id="8049705080247101012">У Google пашырэнне "<ph name="EXTENSION_NAME" />" абазначана як шкоднае. Яго ўсталяванне было прадухілена</translation>
<translation id="8049948037269924837">Адваротная прагортка сэнсарнай панэллю</translation>
<translation id="8050038245906040378">Камерцыйнае падпісванне кода ў Microsoft</translation>
@@ -11 48 5,4 +1148 5,4 @@
@@ -11 578 ,4 +11578 ,4 @@
<translation id="997143476478634194">Пры наведванні сайтаў яны будуць аўтаматычна ўлічваць гэту наладу. Звычайна сайты адпраўляюць апавяшчэнні, каб паведаміць вам пра экстранныя навіны а б о новыя паведамленні ў чаце.</translation>
<translation id="99731366405731005">К а б выкарыстоўваць функцыю сінхранізацыі параметраў Wi-Fi, уключыце <ph name="LINK1_BEGIN" />Сінхранізацыю Chrome<ph name="LINK1_END" />. <ph name="LINK2_BEGIN" />Даведацца больш<ph name="LINK2_END" /></translation>
<translation id="998747458861718449">Пра&верыць</translation>
@ -65,10 +65,10 @@ index ba534914bc..b79dc7658e 100644
\ No newline at end of file
+</translationbundle>
diff --git a/chrome/app/resources/generated_resources_en-GB.xtb b/chrome/app/resources/generated_resources_en-GB.xtb
index 969e766c16..a6e8f938ef 100644
index f283ab5ede..5d7368f6e7 100644
--- a/chrome/app/resources/generated_resources_en-GB.xtb
+++ b/chrome/app/resources/generated_resources_en-GB.xtb
@@ -9 74 8,7 +974 8,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
@@ -9 827 ,7 +9827 ,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
<translation id="8048728378294435881">Back up your stuff and use it on any device</translation>
<translation id="8048977114738515028">Create a desktop shortcut on your device to access directly to this profile</translation>
<translation id="8049029041626250638">Connect a keyboard or mouse. If you are using Bluetooth devices, make sure that your devices are ready to pair.</translation>
@ -78,10 +78,10 @@ index 969e766c16..a6e8f938ef 100644
<translation id="8049948037269924837">Touchpad reverse scrolling</translation>
<translation id="8050038245906040378">Microsoft Commercial Code Signing</translation>
diff --git a/chrome/app/resources/generated_resources_ru.xtb b/chrome/app/resources/generated_resources_ru.xtb
index 2 f8d4a2a1f..75c68ba79b 100644
index 2 cea179a09..60a3fd18a2 100644
--- a/chrome/app/resources/generated_resources_ru.xtb
+++ b/chrome/app/resources/generated_resources_ru.xtb
@@ -9 741,7 +9741 ,7 @@
@@ -9 820,7 +9820 ,7 @@
<translation id="8048728378294435881">Создайте резервную копию данных и используйте их на любом устройстве.</translation>
<translation id="8048977114738515028">Чтобы быстро переключаться на этот профиль, создайте ярлык на рабочем столе</translation>
<translation id="8049029041626250638">Подключите мышь или клавиатуру. Если вы используете устройства Bluetooth, убедитесь, что они готовы к подключению.</translation>
@ -91,10 +91,10 @@ index 2f8d4a2a1f..75c68ba79b 100644
<translation id="8049948037269924837">Обратное направление прокрутки с помощью сенсорной панели</translation>
<translation id="8050038245906040378">Подписывание коммерческого кода Microsoft</translation>
diff --git a/chrome/app/resources/generated_resources_uk.xtb b/chrome/app/resources/generated_resources_uk.xtb
index 06937a3c8d..0a9a6a2b5 b 100644
index 2579b09b79..83edc733c b 100644
--- a/chrome/app/resources/generated_resources_uk.xtb
+++ b/chrome/app/resources/generated_resources_uk.xtb
@@ -9 751,7 +9751 ,7 @@
@@ -9 830,7 +9830 ,7 @@
<translation id="8048728378294435881">Створюйте резервні копії даних і використовуйте їх на будь-якому пристрої</translation>
<translation id="8048977114738515028">Створити ярлик на робочому столі, щоб відразу переходити до цього профілю</translation>
<translation id="8049029041626250638">Підключіть клавіатуру а б о мишу. Якщо ви користуєтеся пристроями з Bluetooth, переконайтеся, що вони готові до підключення.</translation>
@ -160,7 +160,7 @@ index cc89f05912..020eb1413d 100644
/** Entrypoint for the upload by url action. */
const UPLOAD_URL_ENTRYPOINT: string = 'cntpubu';
diff --git a/chrome/browser/resources/new_tab_page/lens_upload_dialog.css b/chrome/browser/resources/new_tab_page/lens_upload_dialog.css
index bde20d9920..ef6dfbdd24 100644
index 2f53948285..422291d042 100644
--- a/chrome/browser/resources/new_tab_page/lens_upload_dialog.css
+++ b/chrome/browser/resources/new_tab_page/lens_upload_dialog.css
@@ -109,7 +109,7 @@
@ -173,7 +173,7 @@ index bde20d9920..ef6dfbdd24 100644
position: relative;
width: 100%;
diff --git a/chrome/browser/resources/new_tab_page/lens_upload_dialog.html b/chrome/browser/resources/new_tab_page/lens_upload_dialog.html
index 9e02b5266c..7a4fbfb75f 100644
index 09f613f71a..69ee3a7366 100644
--- a/chrome/browser/resources/new_tab_page/lens_upload_dialog.html
+++ b/chrome/browser/resources/new_tab_page/lens_upload_dialog.html
@@ -22,7 +22,7 @@
@ -270,18 +270,18 @@ index c7ae65114f..5859d72731 100644
bool IsNTPOrRelatedURL(const GURL& url, Profile* profile);
diff --git a/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc b/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc
index 7e67bf7265..b43a0d7bf8 100644
index 9fd661ba51..be7febae29 100644
--- a/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc
+++ b/chrome/browser/ui/webui/new_tab_page/new_tab_page_ui.cc
@@ -3 5,6 +35 ,7 @@
@@ -3 6,6 +36 ,7 @@
#include "chrome/browser/search/background/ntp_custom_background_service_factory.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "chrome/browser/search_provider_logos/logo_service_factory.h"
+#include "chrome/browser/search/search.h"
#include "chrome/browser/segmentation_platform/segmentation_platform_service_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/sync/sync_service_factory.h"
#include "chrome/browser/themes/theme_service_factory.h"
@@ -424,6 +425,10 @@ content::WebUIDataSource* CreateAndAddNewTabPageUiHtmlSource(Profile* profile) {
@@ -453,6 +454,10 @@ content::WebUIDataSource* CreateAndAddNewTabPageUiHtmlSource(Profile* profile) {
base::NumberToString(
ntp_features::kNtpCalendarModuleWindowEndDeltaParam.Get().InHours()));
@ -334,7 +334,7 @@ index 98572faa77..cfb6727848 100644
#endif // COMPONENTS_SEARCH_SEARCH_H_
diff --git a/components/search_engines/keyword_table.cc b/components/search_engines/keyword_table.cc
index d4a9489e93..6cd91a214 7 100644
index c88f019f8d..85afef975 7 100644
--- a/components/search_engines/keyword_table.cc
+++ b/components/search_engines/keyword_table.cc
@@ -173,7 +173,9 @@ void BindURLToStatement(const TemplateURLData& data,
@ -358,10 +358,10 @@ index d4a9489e93..6cd91a2147 100644
data->suggestions_url_post_params = s.ColumnString(18);
data->image_url_post_params = s.ColumnString(19);
diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json
index 40a13e733c..a4911f5394 100644
index 2036ba59e6..5236f359f7 100644
--- a/components/search_engines/prepopulated_engines.json
+++ b/components/search_engines/prepopulated_engines.json
@@ -8 55,7 +855 ,7 @@
@@ -8 38,7 +838 ,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",
@ -370,7 +370,7 @@ index 40a13e733c..a4911f5394 100644
"type": "SEARCH_ENGINE_YANDEX",
"id": 15
},
@@ -8 68,6 +868 ,7 @@
@@ -8 51,6 +851 ,7 @@
"suggest_url": "https://suggest.yandex.com/suggest-ff.cgi?part={searchTerms}&{google:cursorPosition}",
"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",
@ -378,7 +378,7 @@ index 40a13e733c..a4911f5394 100644
"type": "SEARCH_ENGINE_YANDEX",
"id": 15,
"regulatory_extensions": [
@@ -8 93,7 +894 ,7 @@
@@ -8 76,7 +877 ,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",
@ -387,7 +387,7 @@ index 40a13e733c..a4911f5394 100644
"type": "SEARCH_ENGINE_YANDEX",
"id": 15
},
@@ - 907 ,7 +90 8,7 @@
@@ - 8 90,7 +891 ,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",
@ -396,7 +396,7 @@ index 40a13e733c..a4911f5394 100644
"type": "SEARCH_ENGINE_YANDEX",
"id": 15
},
@@ -9 20,7 +921 ,7 @@
@@ -9 03,7 +904 ,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",
@ -405,7 +405,7 @@ index 40a13e733c..a4911f5394 100644
"type": "SEARCH_ENGINE_YANDEX",
"id": 15
},
@@ -9 34,7 +935 ,7 @@
@@ -9 17,7 +918 ,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",
@ -415,7 +415,7 @@ index 40a13e733c..a4911f5394 100644
"id": 15
},
diff --git a/components/search_engines/search_engine_countries-inc.cc b/components/search_engines/search_engine_countries-inc.cc
index 468d6ca0ef..029c2c2966 100644
index a4a0459de0..616430f279 100644
--- a/components/search_engines/search_engine_countries-inc.cc
+++ b/components/search_engines/search_engine_countries-inc.cc
@@ -38,6 +38,7 @@ struct EngineAndTier {
@ -426,7 +426,7 @@ index 468d6ca0ef..029c2c2966 100644
{SearchEngineTier::kTopEngines, &google},
{SearchEngineTier::kTopEngines, &bing},
{SearchEngineTier::kTopEngines, &yahoo},
@@ -17 4,8 +175 ,8 @@ constexpr EngineAndTier engines_BR[] = {
@@ -17 3,8 +174 ,8 @@ constexpr EngineAndTier engines_BR[] = {
// Belarus
constexpr EngineAndTier engines_BY[] = {
@ -436,7 +436,7 @@ index 468d6ca0ef..029c2c2966 100644
{SearchEngineTier::kTopEngines, &bing},
{SearchEngineTier::kTopEngines, &duckduckgo},
{SearchEngineTier::kTopEngines, &mail_ru},
@@ -49 9,9 +500 ,9 @@ constexpr EngineAndTier engines_IN[] = {
@@ -49 8,9 +499 ,9 @@ constexpr EngineAndTier engines_IN[] = {
// Iraq
constexpr EngineAndTier engines_IQ[] = {
@ -447,7 +447,7 @@ index 468d6ca0ef..029c2c2966 100644
{SearchEngineTier::kTopEngines, &yahoo},
{SearchEngineTier::kTopEngines, &duckduckgo},
};
@@ -59 5,8 +596 ,8 @@ constexpr EngineAndTier engines_KW[] = {
@@ -59 4,8 +595 ,8 @@ constexpr EngineAndTier engines_KW[] = {
// Kazakhstan
constexpr EngineAndTier engines_KZ[] = {
@ -457,7 +457,7 @@ index 468d6ca0ef..029c2c2966 100644
{SearchEngineTier::kTopEngines, &bing},
{SearchEngineTier::kTopEngines, &mail_ru},
{SearchEngineTier::kTopEngines, &yahoo},
@@ -101 2,8 +1013 ,8 @@ constexpr EngineAndTier engines_TN[] = {
@@ -101 0,8 +1011 ,8 @@ constexpr EngineAndTier engines_TN[] = {
// Turkey
constexpr EngineAndTier engines_TR[] = {
@ -468,10 +468,10 @@ index 468d6ca0ef..029c2c2966 100644
{SearchEngineTier::kTopEngines, &bing},
{SearchEngineTier::kTopEngines, &duckduckgo},
diff --git a/components/search_engines/template_url_data_util.cc b/components/search_engines/template_url_data_util.cc
index 2616957c6a..54ee4d1811 100644
index 18364f4324..6dc09f5e63 100644
--- a/components/search_engines/template_url_data_util.cc
+++ b/components/search_engines/template_url_data_util.cc
@@ - 80,10 +80 ,12 @@ std::unique_ptr<TemplateURLData> TemplateURLDataFromDictionary(
@@ - 75,10 +75 ,12 @@ std::unique_ptr<TemplateURLData> TemplateURLDataFromDictionary(
if (string_value) {
result->image_translate_url = *string_value;
}
@ -484,7 +484,7 @@ index 2616957c6a..54ee4d1811 100644
string_value = dict.FindString(DefaultSearchManager::kContextualSearchURL);
if (string_value) {
result->contextual_search_url = *string_value;
@@ -3 51,7 +353 ,7 @@ std::unique_ptr<TemplateURLData> TemplateURLDataFromPrepopulatedEngine(
@@ -3 43,7 +345 ,7 @@ std::unique_ptr<TemplateURLData> TemplateURLDataFromPrepopulatedEngine(
ToU16StringView(engine.name), ToU16StringView(engine.keyword),
ToStringView(engine.search_url), ToStringView(engine.suggest_url),
ToStringView(engine.image_url), ToStringView(engine.image_translate_url),
@ -493,7 +493,7 @@ index 2616957c6a..54ee4d1811 100644
ToStringView(engine.contextual_search_url), ToStringView(engine.logo_url),
ToStringView(engine.doodle_url),
ToStringView(engine.search_url_post_params),
@@ -4 43,10 +445 ,12 @@ std::unique_ptr<TemplateURLData> TemplateURLDataFromOverrideDictionary(
@@ -4 34,10 +436 ,12 @@ std::unique_ptr<TemplateURLData> TemplateURLDataFromOverrideDictionary(
if (string_value) {
image_translate_url = *string_value;
}
@ -507,10 +507,10 @@ index 2616957c6a..54ee4d1811 100644
if (string_value) {
contextual_search_url = *string_value;
diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc
index 208ef4af2b..f30c8a9cb5 100644
index 6c32b0e684..42e0d25e16 100644
--- a/components/search_engines/template_url_prepopulate_data.cc
+++ b/components/search_engines/template_url_prepopulate_data.cc
@@ - 84,6 +84 ,13 @@ GetPrepopulatedEnginesForEeaRegionCountries(int country_id,
@@ - 79,6 +79 ,13 @@ GetPrepopulatedEnginesForEeaRegionCountries(int country_id,
std::shuffle(t_urls.begin(), t_urls.end(), generator);
CHECK_LE(t_urls.size(), kMaxEeaPrepopulatedEngines);
@ -524,7 +524,7 @@ index 208ef4af2b..f30c8a9cb5 100644
return t_urls;
}
@@ -3 24,7 +331 ,7 @@ std::unique_ptr<TemplateURLData> GetPrepopulatedFallbackSearch(
@@ -3 18,7 +325 ,7 @@ std::unique_ptr<TemplateURLData> GetPrepopulatedFallbackSearch(
PrefService* prefs,
search_engines::SearchEngineChoiceService* search_engine_choice_service) {
return FindPrepopulatedEngineInternal(prefs, search_engine_choice_service,