diff --git a/infra/PATCHES.md b/infra/PATCHES.md index ec301df8..12a6e3d7 100644 --- a/infra/PATCHES.md +++ b/infra/PATCHES.md @@ -201,4 +201,7 @@ Patches for mini_installer and abseil when using AVX on Windows. Credit goes to The Thorium .desktop file and content-shell .desktop file have flags added for experimental and useful features, namely: Disabling the Default Browser check and InfoBar, Experimental web platform features, and Experimental Canvas2D. - Modified by me. +Remove discovery module from NTP on Android + - Made by @gz83. + - Any other code/patches are written from scratch by me. diff --git a/other/Android-Remove-discovery-module-from-NTP.patch b/other/Android-Remove-discovery-module-from-NTP.patch new file mode 100644 index 00000000..6d9c412a --- /dev/null +++ b/other/Android-Remove-discovery-module-from-NTP.patch @@ -0,0 +1,78 @@ +From 9d07f991a3996c0219320b77b6611e80053db0e3 Mon Sep 17 00:00:00 2001 +From: Ho Cheung +Date: Wed, 28 Jun 2023 02:52:35 +0800 +Subject: [PATCH] [Android] Remove discovery module from NTP + +Change-Id: Ied94517abba26e45e18b5a98ca5851a2c37b1c42 +--- + .../res/layout/new_tab_page_feed_v2_expandable_header.xml | 5 +++-- + .../java/res/layout/new_tab_page_multi_feed_header.xml | 5 +++-- + components/feed/core/shared_prefs/pref_names.cc | 4 ++-- + 3 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/chrome/browser/feed/android/java/res/layout/new_tab_page_feed_v2_expandable_header.xml b/chrome/browser/feed/android/java/res/layout/new_tab_page_feed_v2_expandable_header.xml +index ee1283cb9a6a0..e15ddc9532cce 100644 +--- a/chrome/browser/feed/android/java/res/layout/new_tab_page_feed_v2_expandable_header.xml ++++ b/chrome/browser/feed/android/java/res/layout/new_tab_page_feed_v2_expandable_header.xml +@@ -1,6 +1,6 @@ + + +@@ -14,7 +14,8 @@ found in the LICENSE file. + android:minHeight="@dimen/snippets_article_header_height" + android:orientation="vertical" + android:gravity="center_vertical" +- android:layoutDirection="locale" > ++ android:layoutDirection="locale" ++ android:visibility="gone" > + + + +@@ -11,7 +11,8 @@ found in the LICENSE file. + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="wrap_content" +- android:orientation="vertical" > ++ android:orientation="vertical" ++ android:visibility="gone" > + + RegisterBooleanPref(kEnableSnippets, true); +- registry->RegisterBooleanPref(kArticlesListVisible, true); ++ registry->RegisterBooleanPref(kArticlesListVisible, false); + registry->RegisterIntegerPref(kVideoPreviewsType, 1); + } + +-- +2.39.1.windows.1 + diff --git a/src/chrome/browser/feed/android/java/res/layout/new_tab_page_feed_v2_expandable_header.xml b/src/chrome/browser/feed/android/java/res/layout/new_tab_page_feed_v2_expandable_header.xml new file mode 100644 index 00000000..e15ddc95 --- /dev/null +++ b/src/chrome/browser/feed/android/java/res/layout/new_tab_page_feed_v2_expandable_header.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + diff --git a/src/chrome/browser/feed/android/java/res/layout/new_tab_page_multi_feed_header.xml b/src/chrome/browser/feed/android/java/res/layout/new_tab_page_multi_feed_header.xml new file mode 100644 index 00000000..df79f5c2 --- /dev/null +++ b/src/chrome/browser/feed/android/java/res/layout/new_tab_page_multi_feed_header.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/src/components/feed/core/shared_prefs/pref_names.cc b/src/components/feed/core/shared_prefs/pref_names.cc new file mode 100644 index 00000000..21c7aab6 --- /dev/null +++ b/src/components/feed/core/shared_prefs/pref_names.cc @@ -0,0 +1,31 @@ +// Copyright 2020 The Chromium Authors, Alex313031 and gz83 +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_FEED_CORE_SHARED_PREFS_PREF_NAMES_CC_ +#define COMPONENTS_FEED_CORE_SHARED_PREFS_PREF_NAMES_CC_ + +#include "components/feed/core/shared_prefs/pref_names.h" + +#include "components/prefs/pref_registry_simple.h" + +namespace feed { +namespace prefs { + +const char kEnableSnippets[] = "ntp_snippets.enable"; +// A boolean pref set to true if Feed articles are visible. +// FEED_ARTICLES_LIST_VISIBLE in ChromePreferenceKeys.java is a pre-native cache +// and should be consistent with this pref. +const char kArticlesListVisible[] = "ntp_snippets.list_visible"; +const char kVideoPreviewsType[] = "ntp_snippets.video_previews_type"; + +void RegisterFeedSharedProfilePrefs(PrefRegistrySimple* registry) { + registry->RegisterBooleanPref(kEnableSnippets, true); + registry->RegisterBooleanPref(kArticlesListVisible, false); + registry->RegisterIntegerPref(kVideoPreviewsType, 1); +} + +} // namespace prefs +} // namespace feed + +#endif // COMPONENTS_FEED_CORE_SHARED_PREFS_PREF_NAMES_CC_