Update Yandex patch

i9e
Arkady L. Shane 6 months ago
parent 51dcdcb4a4
commit b19d677ad8
Signed by: tigro
GPG Key ID: 1EC08A25C9DB2503

@ -1,32 +1,32 @@
From 68d8154734023ebc37fb4b87ab7a7fd6d2815bd2 Mon Sep 17 00:00:00 2001
From: Sergey Cherevko <s.cherevko@msvsphere-os.ru>
Date: Fri, 14 Jun 2024 18:36:08 +0300
From f823aa91e0a714774a2ca18ccb402078c7336929 Mon Sep 17 00:00:00 2001
From: tigro <tigro@msvsphere-os.ru>
Date: Sun, 16 Jun 2024 15:49:58 +0300
Subject: [PATCH] Added Yandex search bar as default on newtab and new-tab-page
---
chrome/app/generated_resources.grd | 2 --
.../app/resources/generated_resources_be.xtb | 4 ++--
.../resources/generated_resources_en-GB.xtb | 4 ++--
.../app/resources/generated_resources_ru.xtb | 4 ++--
.../app/resources/generated_resources_uk.xtb | 4 ++--
.../app/resources/generated_resources_be.xtb | 2 +-
.../resources/generated_resources_en-GB.xtb | 2 +-
.../app/resources/generated_resources_ru.xtb | 2 +-
.../app/resources/generated_resources_uk.xtb | 2 +-
chrome/browser/history/top_sites_factory.cc | 4 ++--
.../resources/new_tab_page/lens_form.html | 1 +
.../resources/new_tab_page/lens_form.ts | 20 ++++++++++++++++++-
.../resources/new_tab_page/lens_form.ts | 19 ++++++++++++++++++-
.../new_tab_page/lens_upload_dialog.html | 10 +++++-----
.../browser/resources/new_tab_page/logo.html | 5 +----
chrome/browser/resources/new_tab_page/logo.ts | 2 +-
chrome/browser/search/search.cc | 7 +++++++
chrome/browser/search/search.h | 2 ++
.../ui/webui/new_tab_page/new_tab_page_ui.cc | 5 +++++
components/search/search.cc | 14 +++++++++++++
components/search/search.cc | 14 ++++++++++++++
components/search/search.h | 7 +++++++
components/search_engines/keyword_table.cc | 4 ++++
.../search_engines/prepopulated_engines.json | 11 +++++-----
.../search_engine_countries-inc.cc | 11 +++++-----
.../search_engines/prepopulated_engines.json | 11 ++++++-----
.../search_engine_countries-inc.cc | 9 +++++----
.../search_engines/template_url_data_util.cc | 6 +++++-
.../template_url_prepopulate_data.cc | 15 ++++++++------
.../template_url_prepopulate_data.cc | 15 +++++++++------
.../cr_components/searchbox/realbox.html | 7 +++++++
22 files changed, 109 insertions(+), 40 deletions(-)
22 files changed, 103 insertions(+), 35 deletions(-)
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index b54ec8a465..4043570c4b 100644
@ -44,7 +44,7 @@ index b54ec8a465..4043570c4b 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 e6f66c5fdd..15e1e75fdf 100644
index e6f66c5fdd..f1d9597fef 100644
--- a/chrome/app/resources/generated_resources_be.xtb
+++ b/chrome/app/resources/generated_resources_be.xtb
@@ -9407,7 +9407,7 @@
@ -56,15 +56,8 @@ index e6f66c5fdd..15e1e75fdf 100644
<translation id="8049705080247101012">У Google пашырэнне "<ph name="EXTENSION_NAME" />" абазначана як шкоднае. Яго ўсталяванне было прадухілена</translation>
<translation id="8049948037269924837">Адваротная прагортка сэнсарнай панэллю</translation>
<translation id="8050038245906040378">Камерцыйнае падпісванне кода ў Microsoft</translation>
@@ -11112,4 +11112,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">Пра&amp;верыць</translation>
-</translationbundle>
\ 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 16706b18e5..f1393a6bf8 100644
index 16706b18e5..bae533b582 100644
--- a/chrome/app/resources/generated_resources_en-GB.xtb
+++ b/chrome/app/resources/generated_resources_en-GB.xtb
@@ -9421,7 +9421,7 @@ Keep your key file in a safe place. You will need it to create new versions of y
@ -76,15 +69,8 @@ index 16706b18e5..f1393a6bf8 100644
<translation id="8049705080247101012">Google has flagged '<ph name="EXTENSION_NAME" />' as malicious, and installation has been prevented</translation>
<translation id="8049948037269924837">Touchpad reverse scrolling</translation>
<translation id="8050038245906040378">Microsoft Commercial Code Signing</translation>
@@ -11126,4 +11126,4 @@ Permissions that you've already given to websites and apps may apply to this acc
<translation id="997143476478634194">Sites automatically follow this setting when you visit them. Sites usually send notifications to let you know about breaking news or chat messages.</translation>
<translation id="99731366405731005">Turn on <ph name="LINK1_BEGIN" />Chrome Sync<ph name="LINK1_END" /> to use Wi-Fi Sync. <ph name="LINK2_BEGIN" />Learn more<ph name="LINK2_END" /></translation>
<translation id="998747458861718449">I&amp;nspect</translation>
-</translationbundle>
\ No newline at end of file
+</translationbundle>
diff --git a/chrome/app/resources/generated_resources_ru.xtb b/chrome/app/resources/generated_resources_ru.xtb
index a048aeac98..9363e6bc96 100644
index a048aeac98..561eb8746d 100644
--- a/chrome/app/resources/generated_resources_ru.xtb
+++ b/chrome/app/resources/generated_resources_ru.xtb
@@ -9412,7 +9412,7 @@
@ -96,15 +82,8 @@ index a048aeac98..9363e6bc96 100644
<translation id="8049705080247101012">Google заблокировал установку потенциально опасной программы (<ph name="EXTENSION_NAME" />).</translation>
<translation id="8049948037269924837">Обратное направление прокрутки с помощью сенсорной панели</translation>
<translation id="8050038245906040378">Подписывание коммерческого кода Microsoft</translation>
@@ -11120,4 +11120,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">П&amp;росмотреть код</translation>
-</translationbundle>
\ No newline at end of file
+</translationbundle>
diff --git a/chrome/app/resources/generated_resources_uk.xtb b/chrome/app/resources/generated_resources_uk.xtb
index fa169a612c..751be07c7c 100644
index fa169a612c..90305e3675 100644
--- a/chrome/app/resources/generated_resources_uk.xtb
+++ b/chrome/app/resources/generated_resources_uk.xtb
@@ -9426,7 +9426,7 @@
@ -116,13 +95,6 @@ index fa169a612c..751be07c7c 100644
<translation id="8049705080247101012">Система Google позначила розширення <ph name="EXTENSION_NAME" /> як шкідливе та заборонила встановлення</translation>
<translation id="8049948037269924837">Зворотне прокручування на сенсорній панелі</translation>
<translation id="8050038245906040378">Підписування комерційного коду Microsoft</translation>
@@ -11134,4 +11134,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>
-</translationbundle>
\ No newline at end of file
+</translationbundle>
diff --git a/chrome/browser/history/top_sites_factory.cc b/chrome/browser/history/top_sites_factory.cc
index 8f20a76a66..d1a13e7046 100644
--- a/chrome/browser/history/top_sites_factory.cc
@ -158,16 +130,15 @@ index 57c6387c7e..0f31a59767 100644
<input name="ep" value="[[uploadUrlEntrypoint_]]"></input>
<input name="hl" value="[[language_]]"></input>
diff --git a/chrome/browser/resources/new_tab_page/lens_form.ts b/chrome/browser/resources/new_tab_page/lens_form.ts
index bf24f4c495..53fd771d7d 100644
index bf24f4c495..167b57bc5e 100644
--- a/chrome/browser/resources/new_tab_page/lens_form.ts
+++ b/chrome/browser/resources/new_tab_page/lens_form.ts
@@ -12,11 +12,15 @@ import {getTemplate} from './lens_form.html.js';
@@ -12,11 +12,14 @@ import {getTemplate} from './lens_form.html.js';
/** Lens service endpoint for the Upload by File action. */
const SCOTTY_UPLOAD_FILE_ACTION: string = 'https://lens.google.com/upload';
const DIRECT_UPLOAD_FILE_ACTION: string = 'https://lens.google.com/v3/upload';
+const SCOTTY_UPLOAD_FILE_ACTION_YA: string = 'https://yandex.ru/images/search';
+const DIRECT_UPLOAD_FILE_ACTION_YA: string = 'https://yandex.ru/images/search';
+
/** Entrypoint for the upload by file action. */
const UPLOAD_FILE_ENTRYPOINT: string = 'cntpubb';
@ -177,7 +148,7 @@ index bf24f4c495..53fd771d7d 100644
const UPLOAD_BY_URL_ACTION: string = 'https://lens.google.com/uploadbyurl';
/** Entrypoint for the upload by url action. */
@@ -74,6 +78,7 @@ export class LensFormElement extends PolymerElement {
@@ -74,6 +77,7 @@ export class LensFormElement extends PolymerElement {
}
static get properties() {
@ -185,7 +156,7 @@ index bf24f4c495..53fd771d7d 100644
return {
supportedFileTypes_: {
type: String,
@@ -99,7 +104,7 @@ export class LensFormElement extends PolymerElement {
@@ -99,7 +103,7 @@ export class LensFormElement extends PolymerElement {
uploadUrlAction_: {
type: String,
readOnly: true,
@ -194,7 +165,7 @@ index bf24f4c495..53fd771d7d 100644
},
uploadUrl_: String,
uploadUrlEntrypoint_: {
@@ -117,6 +122,11 @@ export class LensFormElement extends PolymerElement {
@@ -117,6 +121,11 @@ export class LensFormElement extends PolymerElement {
readOnly: true,
value: loadTimeData.getString('realboxLensVariations'),
},
@ -206,7 +177,7 @@ index bf24f4c495..53fd771d7d 100644
};
}
@@ -126,6 +136,7 @@ export class LensFormElement extends PolymerElement {
@@ -126,6 +135,7 @@ export class LensFormElement extends PolymerElement {
private startTime_: string|null = null;
private clientData_: string;
private useDirectUpload_: boolean;
@ -214,7 +185,7 @@ index bf24f4c495..53fd771d7d 100644
openSystemFilePicker() {
this.$.fileInput.click();
@@ -153,6 +164,11 @@ export class LensFormElement extends PolymerElement {
@@ -153,6 +163,11 @@ export class LensFormElement extends PolymerElement {
}
private async submitFile_(file: File) {
@ -226,7 +197,7 @@ index bf24f4c495..53fd771d7d 100644
if (!SUPPORTED_FILE_TYPES.includes(file.type)) {
this.dispatchError_(LensErrorType.FILE_TYPE);
return;
@@ -194,8 +210,10 @@ export class LensFormElement extends PolymerElement {
@@ -194,8 +209,10 @@ export class LensFormElement extends PolymerElement {
processedFile.imageWidth ? processedFile.imageWidth.toString() : '');
this.uploadFileAction_ = action.toString();
@ -238,7 +209,7 @@ index bf24f4c495..53fd771d7d 100644
submitUrl(urlString: string) {
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 a6eb910711..45ad51baa7 100644
index a6eb910711..703311b280 100644
--- a/chrome/browser/resources/new_tab_page/lens_upload_dialog.html
+++ b/chrome/browser/resources/new_tab_page/lens_upload_dialog.html
@@ -99,7 +99,7 @@
@ -264,7 +235,7 @@ index a6eb910711..45ad51baa7 100644
</span>
</div>
- </div>
+ </div>-->
+ </div>//-->
<div id="urlUploadContainer">
- <div id="sectionDivider">
+ <!--<div id="sectionDivider">
@ -272,7 +243,7 @@ index a6eb910711..45ad51baa7 100644
<div id="orLabel">$i18n{lensSearchUploadDialogOrText}</div>
<div class="divider-line"></div>
- </div>
+ </div>-->
+ </div>//-->
<div id="inputContainer">
<input id="inputBox" autocomplete="false" autocorrect="false"
placeholder="$i18n{lensSearchUploadDialogTextPlaceholder}"
@ -306,22 +277,10 @@ index b6140ec10f..7c3f6e00df 100644
private computeShowDoodle_(): boolean {
diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc
index 916e1c043f..2961e407d3 100644
index 916e1c043f..652c01e92d 100644
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -130,6 +130,11 @@ bool IsMatchingServiceWorker(const GURL& my_url, const GURL& document_url) {
return my_path_without_filename == document_path_without_filename;
}
+bool DefaultSearchProviderIsYandex(Profile* profile) {
+ return DefaultSearchProviderIsYandex(
+ TemplateURLServiceFactory::GetForProfile(profile));
+}
+
// Returns true if |url| matches the NTP URL or the URL of the NTP's associated
// service worker.
bool IsNTPOrRelatedURLHelper(const GURL& url, Profile* profile) {
@@ -174,6 +179,8 @@ struct NewTabURLDetails {
@@ -174,6 +174,8 @@ struct NewTabURLDetails {
#if BUILDFLAG(IS_ANDROID)
const GURL local_url;
@ -330,6 +289,18 @@ index 916e1c043f..2961e407d3 100644
#else
const bool default_is_google = DefaultSearchProviderIsGoogle(profile);
const GURL local_url(default_is_google
@@ -240,6 +242,11 @@ bool DefaultSearchProviderIsGoogle(Profile* profile) {
TemplateURLServiceFactory::GetForProfile(profile));
}
+bool DefaultSearchProviderIsYandex(Profile* profile) {
+ return DefaultSearchProviderIsYandex(
+ TemplateURLServiceFactory::GetForProfile(profile));
+}
+
bool IsNTPOrRelatedURL(const GURL& url, Profile* profile) {
if (!url.is_valid()) {
return false;
diff --git a/chrome/browser/search/search.h b/chrome/browser/search/search.h
index c7ae65114f..5859d72731 100644
--- a/chrome/browser/search/search.h
@ -344,7 +315,7 @@ 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 41036ffb07..b7cc6d8b48 100644
index 41036ffb07..2b0b90b553 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
@@ -36,6 +36,7 @@
@ -355,7 +326,7 @@ index 41036ffb07..b7cc6d8b48 100644
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/sync/sync_service_factory.h"
#include "chrome/browser/themes/theme_service_factory.h"
@@ -655,6 +656,10 @@ content::WebUIDataSource* CreateAndAddNewTabPageUiHtmlSource(Profile* profile) {
@@ -661,6 +662,10 @@ content::WebUIDataSource* CreateAndAddNewTabPageUiHtmlSource(Profile* profile) {
base::FeatureList::IsEnabled(
ntp_features::kNtpChromeCartInHistoryClusterModule));
@ -363,9 +334,9 @@ index 41036ffb07..b7cc6d8b48 100644
+ "googleLensForYandex",
+ search::DefaultSearchProviderIsYandex(profile));
+
source->AddBoolean(
"showCartInQuestModuleSetting",
IsCartModuleEnabled() &&
SearchboxHandler::SetupWebUIDataSource(
source, profile,
/*enable_voice_search=*/true,
diff --git a/components/search/search.cc b/components/search/search.cc
index a7167fae92..67d36156c5 100644
--- a/components/search/search.cc
@ -489,7 +460,7 @@ index 91539be7a0..63b30e6c92 100644
"id": 15
},
diff --git a/components/search_engines/search_engine_countries-inc.cc b/components/search_engines/search_engine_countries-inc.cc
index 6c8ffb9e7d..4c99be8769 100644
index 6c8ffb9e7d..417cb0009c 100644
--- a/components/search_engines/search_engine_countries-inc.cc
+++ b/components/search_engines/search_engine_countries-inc.cc
@@ -33,6 +33,7 @@ struct EngineAndTier {
@ -541,16 +512,6 @@ index 6c8ffb9e7d..4c99be8769 100644
{SearchEngineTier::kTopEngines, &yahoo_tr},
{SearchEngineTier::kTopEngines, &bing},
{SearchEngineTier::kTopEngines, &duckduckgo},
@@ -1043,8 +1044,8 @@ constexpr EngineAndTier engines_TZ[] = {
// Ukraine
constexpr EngineAndTier engines_UA[] = {
- {SearchEngineTier::kTopEngines, &google},
{SearchEngineTier::kTopEngines, &yandex_ru},
+ {SearchEngineTier::kTopEngines, &google},
{SearchEngineTier::kTopEngines, &bing},
{SearchEngineTier::kTopEngines, &duckduckgo},
{SearchEngineTier::kTopEngines, &yahoo},
diff --git a/components/search_engines/template_url_data_util.cc b/components/search_engines/template_url_data_util.cc
index 6f85515188..7791bf8113 100644
--- a/components/search_engines/template_url_data_util.cc
@ -633,5 +594,5 @@ index 007ba1fafa..5fd20d191c 100644
/* Embedders should define --cr-realbox-min-width. */
--cr-realbox-shadow: 0 1px 6px 0 var(--color-realbox-shadow);
--
2.39.3
2.45.1

Loading…
Cancel
Save