Browse Source

Fix search

master
wchen342 2 years ago
parent
commit
3cd511f0fc
Signed by: wchen342 GPG Key ID: 9C19365D69B04CEC
  1. 17
      patches/Bromite/Add-a-proxy-configuration-page.patch
  2. 21
      patches/Bromite/Add-option-to-not-persist-tabs-across-sessions.patch
  3. 3
      patches/series
  4. 14
      patches/src-fix/fix-safe-browsing-prefs.patch
  5. 201
      patches/ungoogled-chromium-android/Enable-update-notification.patch

17
patches/Bromite/Add-a-proxy-configuration-page.patch

@ -11,7 +11,7 @@ for SimpleURLLoaders as well.
---
chrome/android/java/res/values/values.xml | 3
chrome/android/java/res/xml/privacy_preferences.xml | 4
chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java | 4
chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java | 3
chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc | 2
chrome/browser/browser_resources.grd | 6
chrome/browser/net/proxy_service_factory.cc | 23
@ -33,7 +33,7 @@ for SimpleURLLoaders as well.
components/proxy_config/proxy_config_dictionary.h | 7
net/proxy_resolution/proxy_config.cc | 52 +
net/proxy_resolution/proxy_config.h | 3
24 files changed, 996 insertions(+), 15 deletions(-)
24 files changed, 995 insertions(+), 15 deletions(-)
create mode 100644 chrome/browser/resources/proxy_config.css
create mode 100644 chrome/browser/resources/proxy_config.html
create mode 100644 chrome/browser/resources/proxy_config.js
@ -67,8 +67,11 @@ for SimpleURLLoaders as well.
android:title="@string/can_make_payment_title"
--- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java
@@ -56,13 +56,15 @@ public class PrivacySettings
@@ -55,9 +55,10 @@ public class PrivacySettings
private static final String PREF_CLEAR_BROWSING_DATA = "clear_browsing_data";
private static final String PREF_PRIVACY_SANDBOX = "privacy_sandbox";
private static final String PREF_CLOSE_TABS_ON_EXIT = "close_tabs_on_exit";
+ private static final String PREF_PROXY_OPTIONS = "proxy";
private static final String[] NEW_PRIVACY_PREFERENCE_ORDER = {PREF_CLEAR_BROWSING_DATA,
PREF_SAFE_BROWSING, PREF_CAN_MAKE_PAYMENT, PREF_NETWORK_PREDICTIONS, PREF_USAGE_STATS,
- PREF_CLOSE_TABS_ON_EXIT,
@ -76,14 +79,6 @@ for SimpleURLLoaders as well.
PREF_SECURE_DNS, PREF_DO_NOT_TRACK, PREF_PRIVACY_SANDBOX};
private ManagedPreferenceDelegate mManagedPreferenceDelegate;
private static final String PREF_CLOSE_TABS_ON_EXIT = "close_tabs_on_exit";
+ private static final String PREF_PROXY_OPTIONS = "proxy";
+
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
PrivacyPreferencesManagerImpl privacyPrefManager =
--- a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc
+++ b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc
@@ -331,6 +331,8 @@ std::vector<base::string16>

21
patches/Bromite/Add-option-to-not-persist-tabs-across-sessions.patch

@ -3,11 +3,11 @@ Date: Sat, 7 Sep 2019 15:07:42 +0200
Subject: Add option to not persist tabs across sessions
---
chrome/android/java/res/xml/privacy_preferences.xml | 16 ++++++---
chrome/android/java/res/xml/privacy_preferences.xml | 16 ++++++----
chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java | 4 +-
chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java | 17 +++++++++-
chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java | 16 +++++++++-
chrome/browser/ui/android/strings/android_chrome_strings.grd | 6 +++
4 files changed, 36 insertions(+), 7 deletions(-)
4 files changed, 35 insertions(+), 7 deletions(-)
--- a/chrome/android/java/res/xml/privacy_preferences.xml
+++ b/chrome/android/java/res/xml/privacy_preferences.xml
@ -87,21 +87,18 @@ Subject: Add option to not persist tabs across sessions
import org.chromium.chrome.R;
import org.chromium.chrome.browser.feedback.HelpAndFeedbackLauncherImpl;
import org.chromium.chrome.browser.flags.ChromeFeatureList;
@@ -53,10 +56,13 @@ public class PrivacySettings
@@ -51,8 +54,10 @@ public class PrivacySettings
private static final String PREF_SAFE_BROWSING = "safe_browsing";
private static final String PREF_CLEAR_BROWSING_DATA = "clear_browsing_data";
private static final String PREF_PRIVACY_SANDBOX = "privacy_sandbox";
+ private static final String PREF_CLOSE_TABS_ON_EXIT = "close_tabs_on_exit";
private static final String[] NEW_PRIVACY_PREFERENCE_ORDER = {PREF_CLEAR_BROWSING_DATA,
PREF_SAFE_BROWSING, PREF_CAN_MAKE_PAYMENT, PREF_NETWORK_PREDICTIONS, PREF_USAGE_STATS,
+ PREF_CLOSE_TABS_ON_EXIT,
PREF_SECURE_DNS, PREF_DO_NOT_TRACK, PREF_PRIVACY_SANDBOX};
private ManagedPreferenceDelegate mManagedPreferenceDelegate;
+ private static final String PREF_CLOSE_TABS_ON_EXIT = "close_tabs_on_exit";
+
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
PrivacyPreferencesManagerImpl privacyPrefManager =
@@ -151,7 +157,11 @@ public class PrivacySettings
@@ -151,7 +156,11 @@ public class PrivacySettings
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
String key = preference.getKey();
@ -114,7 +111,7 @@ Subject: Add option to not persist tabs across sessions
UserPrefs.get(Profile.getLastUsedRegularProfile())
.setBoolean(Pref.CAN_MAKE_PAYMENT_ENABLED, (boolean) newValue);
} else if (PREF_NETWORK_PREDICTIONS.equals(key)) {
@@ -215,6 +225,11 @@ public class PrivacySettings
@@ -215,6 +224,11 @@ public class PrivacySettings
getPreferenceScreen().removePreference(usageStatsPref);
}
}

3
patches/series

@ -4,6 +4,7 @@ src-fix/fix-unkown-warning-clang.patch
src-fix/fix-safe-browsing-prefs.patch
src-fix/fix-prefs.patch
src-fix/fix-base-feature.patch
src-fix/fix-search-template.patch
Vanadium/0003-switch-to-fstack-protector-strong.patch
Vanadium/0016-disable-seed-based-field-trials.patch
Vanadium/0017-disable-fetching-variations.patch
@ -56,5 +57,3 @@ Bromite/DoH-secure-mode-by-default.patch
Bromite/Revert-flags-remove-disable-pull-to-refresh-effect.patch
Bromite/Disable-DRM-media-origin-IDs-preprovisioning.patch
Bromite/AImageReader-CFI-crash-mitigations.patch
Other/debug-fix.patch

14
patches/src-fix/fix-safe-browsing-prefs.patch

@ -22,6 +22,7 @@ Subject: Fix build error caused by the removal of safe_browsing_prefs.h
chrome/browser/safe_browsing/android/java/src/org/chromium/chrome/browser/safe_browsing/settings/RadioButtonGroupSafeBrowsingPreference.java | 37 -
chrome/browser/safe_browsing/android/java/src/org/chromium/chrome/browser/safe_browsing/settings/SafeBrowsingSettingsFragment.java | 170 --------
chrome/browser/safe_browsing/android/java/src/org/chromium/chrome/browser/safe_browsing/settings/StandardProtectionSettingsFragment.java | 8
components/safe_browsing/core/features.cc | 2
weblayer/browser/browser_context_impl.cc | 2
weblayer/browser/browser_process.cc | 11
weblayer/browser/browser_process.h | 4
@ -30,7 +31,7 @@ Subject: Fix build error caused by the removal of safe_browsing_prefs.h
weblayer/browser/profile_impl.cc | 16
weblayer/browser/safe_browsing/safe_browsing_blocking_page.cc | 8
weblayer/browser/safe_browsing/safe_browsing_service.cc | 200 ----------
27 files changed, 53 insertions(+), 558 deletions(-)
28 files changed, 54 insertions(+), 559 deletions(-)
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@ -1259,3 +1260,14 @@ Subject: Fix build error caused by the removal of safe_browsing_prefs.h
auto* sb_service = BrowserProcess::GetInstance()->GetSafeBrowsingService();
if (sb_service)
safe_browsing_context = sb_service->GetNetworkContext();
--- a/components/safe_browsing/core/features.cc
+++ b/components/safe_browsing/core/features.cc
@@ -121,7 +121,7 @@ constexpr base::FeatureParam<bool> kShou
&kPasswordProtectionForSignedInUsers, "DeprecateOldProto", false};
const base::Feature kSafeBrowsingSectionUIAndroid{
- "SafeBrowsingSecuritySectionUIAndroid", base::FEATURE_ENABLED_BY_DEFAULT};
+ "SafeBrowsingSecuritySectionUIAndroid", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kSuspiciousSiteTriggerQuotaFeature{
"SafeBrowsingSuspiciousSiteTriggerQuota", base::FEATURE_ENABLED_BY_DEFAULT};

201
patches/ungoogled-chromium-android/Enable-update-notification.patch

@ -1,16 +1,14 @@
---
chrome/android/chrome_java_sources.gni | 2
chrome/android/chrome_java_sources.gni | 1
chrome/android/java/AndroidManifest.xml | 2
chrome/android/java/src/org/chromium/chrome/browser/download/ChromeUpdateDownloadDelegate.java | 167 +++++++
chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateConfigs.java | 9
chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java | 20
chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateControllerFactory.java | 2
chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/UCInlineUpdateController.java | 236 ++++++++++
chrome/browser/flag_descriptions.cc | 5
chrome/browser/flags/android/chrome_feature_list.cc | 1
chrome/browser/ui/android/strings/android_chrome_strings.grd | 2
chrome/browser/updates/update_notification_config.cc | 4
11 files changed, 437 insertions(+), 13 deletions(-)
9 files changed, 267 insertions(+), 10 deletions(-)
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/UCInlineUpdateController.java
@ -253,15 +251,7 @@
+}
--- a/chrome/android/chrome_java_sources.gni
+++ b/chrome/android/chrome_java_sources.gni
@@ -520,6 +520,7 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java",
"java/src/org/chromium/chrome/browser/dom_distiller/TabDistillabilityProvider.java",
"java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java",
+ "java/src/org/chromium/chrome/browser/download/ChromeUpdateDownloadDelegate.java",
"java/src/org/chromium/chrome/browser/download/DownloadActivity.java",
"java/src/org/chromium/chrome/browser/download/DownloadBroadcastManagerImpl.java",
"java/src/org/chromium/chrome/browser/download/DownloadController.java",
@@ -948,6 +949,7 @@ chrome_java_sources = [
@@ -948,6 +948,7 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateController.java",
"java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateControllerFactory.java",
"java/src/org/chromium/chrome/browser/omaha/inline/NoopInlineUpdateController.java",
@ -446,188 +436,3 @@
</message>
<message name="IDS_UPDATE_NOTIFICATION_TITLE_EXPERIMENTAL_UPDATE_CHROME" desc="Experimental version A title of update notification to remind user to update Chrome.">
Update Chrome
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeUpdateDownloadDelegate.java
@@ -0,0 +1,167 @@
+// Copyright 2021 The Ungoogled Chromium Authors. All rights reserved.
+//
+// This file is part of Ungoogled Chromium Android.
+//
+// Ungoogled Chromium Android is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or any later version.
+//
+// Ungoogled Chromium Android is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Ungoogled Chromium Android. If not,
+// see <https://www.gnu.org/licenses/>.
+
+package org.chromium.chrome.browser.download;
+
+import android.Manifest.permission;
+import android.app.DownloadManager;
+import android.content.pm.PackageManager;
+import android.net.Uri;
+import android.os.Environment;
+import android.text.TextUtils;
+import android.util.Pair;
+import android.webkit.MimeTypeMap;
+import android.webkit.URLUtil;
+
+import androidx.annotation.VisibleForTesting;
+
+import org.chromium.base.Log;
+import org.chromium.base.ThreadUtils;
+import org.chromium.base.UserData;
+import org.chromium.base.UserDataHost;
+import org.chromium.base.task.AsyncTask;
+import org.chromium.chrome.browser.tab.Tab;
+import org.chromium.components.embedder_support.util.UrlConstants;
+import org.chromium.ui.base.PermissionCallback;
+import org.chromium.ui.base.WindowAndroid;
+
+import java.io.File;
+
+/**
+ * Chrome implementation of the ContentViewDownloadDelegate interface.
+ * Extends from the Context Menu Download Delegate.
+ *
+ * Listens to POST and GET download events. GET download requests are passed along to the
+ * Android Download Manager. POST downloads are expected to be handled natively and listener
+ * is responsible for adding the completed download to the download manager.
+ */
+public class ChromeUpdateDownloadDelegate extends ChromeDownloadDelegate
+ implements DownloadController.Observer {
+ private static final String TAG = "UpdateDownload";
+
+ private static final Class<ChromeUpdateDownloadDelegate> USER_DATA_KEY = ChromeUpdateDownloadDelegate.class;
+ private Tab mTab;
+
+ public static ChromeUpdateDownloadDelegate from(Tab tab) {
+ UserDataHost host = tab.getUserDataHost();
+ ChromeUpdateDownloadDelegate controller = host.getUserData(USER_DATA_KEY);
+ return controller == null ? host.setUserData(USER_DATA_KEY,
+ new ChromeUpdateDownloadDelegate(tab))
+ : controller;
+ }
+
+ /**
+ * Creates ChromeUpdateDownloadDelegate.
+ * @param tab The corresponding tab instance.
+ */
+ @VisibleForTesting
+ ChromeUpdateDownloadDelegate(Tab tab) {
+ super(tab);
+ mTab = tab;
+ DownloadController.setDownloadNotificationService(this);
+ }
+
+ @Override
+ public void destroy() {
+ mTab = null;
+ super.destroy();
+ }
+
+ /**
+ * Call this function to send download to android DownloadManager.
+ *
+ * @param url URL to be downloaded.
+ * @return whether the download is successfully started
+ */
+ public boolean startDownload(String url) {
+ Uri uri = Uri.parse(url);
+ String scheme = uri.normalizeScheme().getScheme();
+ if (!UrlConstants.HTTP_SCHEME.equals(scheme) && !UrlConstants.HTTPS_SCHEME.equals(scheme)) {
+ return false;
+ }
+ if (mTab == null) return false;
+ String fileExtenstion = MimeTypeMap.getFileExtensionFromUrl(url);
+ String fileName = URLUtil.guessFileName(url, null, fileExtenstion);
+ final DownloadInfo downloadInfo =
+ new DownloadInfo.Builder().setUrl(url).setFileName(fileName).build();
+ WindowAndroid window = mTab.getWindowAndroid();
+ if (window.hasPermission(permission.WRITE_EXTERNAL_STORAGE)) {
+ onDownloadStartNoStream(downloadInfo);
+ } else if (window.canRequestPermission(permission.WRITE_EXTERNAL_STORAGE)) {
+ PermissionCallback permissionCallback = (permissions, grantResults) -> {
+ if (grantResults.length > 0
+ && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ onDownloadStartNoStream(downloadInfo);
+ }
+ };
+ window.requestPermissions(
+ new String[] {permission.WRITE_EXTERNAL_STORAGE}, permissionCallback);
+ }
+ return true;
+ }
+
+ /**
+ * Should not be called.
+ */
+ @Override
+ public boolean shouldInterceptContextMenuDownload(String url) {
+ return false;
+ }
+
+ /**
+ * Notify the host application that a download is finished.
+ *
+ * @param downloadInfo Information about the completed download.
+ */
+ @Override
+ public void onDownloadCompleted(DownloadInfo downloadInfo) {
+ Log.d(TAG, "onDownloadCompleted");
+ }
+
+ /**
+ * Notify the host application that a download is in progress.
+ *
+ * @param downloadInfo Information about the in-progress download.
+ */
+ @Override
+ public void onDownloadUpdated(DownloadInfo downloadInfo) {
+ Log.d(TAG, "onDownloadUpdated");
+
+ }
+
+ /**
+ * Notify the host application that a download is cancelled.
+ *
+ * @param downloadInfo Information about the cancelled download.
+ */
+ @Override
+ public void onDownloadCancelled(DownloadInfo downloadInfo) {
+ Log.d(TAG, "onDownloadCancelled");
+ }
+
+ /**
+ * Notify the host application that a download is interrupted.
+ *
+ * @param downloadInfo Information about the completed download.
+ * @param isAutoResumable Download can be auto resumed when network becomes available.
+ */
+ @Override
+ public void onDownloadInterrupted(DownloadInfo downloadInfo, boolean isAutoResumable) {
+ Log.d(TAG, "onDownloadInterrupted");
+ }
+}
--- a/chrome/browser/flag_descriptions.cc
+++ b/chrome/browser/flag_descriptions.cc
@@ -3281,10 +3281,9 @@ const char kVoiceButtonInTopToolbarName[
const char kVoiceButtonInTopToolbarDescription[] =
"Enables showing the voice search button in the top toolbar";
-const char kInlineUpdateFlowName[] = "Enable Google Play inline update flow";
+const char kInlineUpdateFlowName[] = "Enable inline update flow";
const char kInlineUpdateFlowDescription[] =
- "When this flag is set, instead of taking the user to the Google Play "
- "Store when an update is available, the user is presented with an inline "
+ "When this flag is set, the user is presented with an inline "
"flow where they do not have to leave Chrome until the update is ready "
"to install.";

Loading…
Cancel
Save