Commit 642470dd authored by Aayush Gupta's avatar Aayush Gupta
Browse files

Browser: Drop upstream adaptive icon patches


Signed-off-by: Aayush Gupta's avatarAayush Gupta <theimpulson@e.email>
parent f89382c8
Pipeline #185942 passed with stages
in 543 minutes and 34 seconds
0001-Browser-Change-app-and-package-name-to-browser.patch
0002-Browser-Use-our-custom-icon-instead-of-chromium.patch
0003-Browser-Rename-strings-to-browser.patch
0004-Browser-Point-to-our-default-popular-sites.patch
0005-Browser-Enable-do-not-track-by-default.patch
0006-Browser-Add-provider-to-share-default-search-engine.patch
0007-Browser-Enable-custom-tabs-by-default.patch
0008-Browser-Enable-search-suggestion-by-default.patch
0009-Browser-Modify-default-search-engines.patch
0010-Browser-Redirect-users-to-e-foundation-docs.patch
0011-Revert-Bromite-auto-updater.patch
0012-Revert-Block-gateway-attacks-via-websockets.patch
0013-Revert-Disable-unified-autoplay-feature.patch
0014-Revert-Make-HTTPS-only-mode-the-default.patch
0002-Revert-Glowup-Fix-round-icons-on-Android-N.patch
0003-Revert-Glowup-Update-Chromium-app-icons-and-add-adap.patch
0004-Browser-Use-our-custom-icon-instead-of-chromium.patch
0005-Browser-Rename-strings-to-browser.patch
0006-Browser-Point-to-our-default-popular-sites.patch
0007-Browser-Enable-do-not-track-by-default.patch
0008-Browser-Add-provider-to-share-default-search-engine.patch
0009-Browser-Enable-custom-tabs-by-default.patch
0010-Browser-Enable-search-suggestion-by-default.patch
0011-Browser-Modify-default-search-engines.patch
0012-Browser-Redirect-users-to-e-foundation-docs.patch
0013-Revert-Bromite-auto-updater.patch
0014-Revert-Block-gateway-attacks-via-websockets.patch
0015-Revert-Disable-unified-autoplay-feature.patch
0016-Revert-Make-HTTPS-only-mode-the-default.patch
From 23a5c116a960fd03a5e8b3718acd5c732a98f404 Mon Sep 17 00:00:00 2001
From: Aayush Gupta <theimpulson@e.email>
Date: Fri, 26 Nov 2021 05:39:25 +0000
Subject: [PATCH 01/14] Browser: Change app and package name to browser
Subject: [PATCH 01/16] Browser: Change app and package name to browser
Signed-off-by: Aayush Gupta <theimpulson@e.email>
---
......
From 43f3a70ba6748d8ecf825be27df895d735fa1482 Mon Sep 17 00:00:00 2001
From: Aayush Gupta <theimpulson@e.email>
Date: Mon, 16 May 2022 03:50:10 +0000
Subject: [PATCH 02/16] Revert "[Glowup] Fix round icons on Android N"
This reverts commit 6fe1f6b94606b60ebf09311a27a6f191df359535.
---
chrome/android/BUILD.gn | 1 -
.../java/res_base/values/ic_launcher_round_alias.xml | 8 --------
2 files changed, 9 deletions(-)
delete mode 100644 chrome/android/java/res_base/values/ic_launcher_round_alias.xml
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
index 0697a16792cf2..2fd43d483350a 100644
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -164,7 +164,6 @@ android_resources("chrome_base_module_resources") {
"java/res_base/font/chrome_google_sans_bold.xml",
"java/res_base/font/chrome_google_sans_medium.xml",
"java/res_base/values/ic_launcher_alias.xml",
- "java/res_base/values/ic_launcher_round_alias.xml",
"java/res_base/values/values.xml",
"java/res_base/xml/network_security_config.xml",
"java/res_chromium_base/mipmap-hdpi/app_icon.png",
diff --git a/chrome/android/java/res_base/values/ic_launcher_round_alias.xml b/chrome/android/java/res_base/values/ic_launcher_round_alias.xml
deleted file mode 100644
index 0b216d5e52732..0000000000000
--- a/chrome/android/java/res_base/values/ic_launcher_round_alias.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright 2022 The Chromium Authors. All rights reserved.
- Use of this source code is governed by a BSD-style license that can be
- found in the LICENSE file. -->
-
-<resources>
- <drawable name="ic_launcher_round">@mipmap/app_icon</drawable>
-</resources>
\ No newline at end of file
--
2.25.1
From caef56e02ae0da805672697aba9ef2d7ff00ca3c Mon Sep 17 00:00:00 2001
From: Aayush Gupta <theimpulson@e.email>
Date: Fri, 26 Nov 2021 07:12:30 +0000
Subject: [PATCH 05/16] Browser: Rename strings to browser
Signed-off-by: Aayush Gupta <theimpulson@e.email>
---
.../java/res/layout/manage_space_activity.xml | 6 +--
...radio_button_group_homepage_preference.xml | 4 +-
.../java/res/xml/about_chrome_preferences.xml | 3 ++
.../android/java/res/xml/main_preferences.xml | 2 +-
.../about_settings/AboutChromeSettings.java | 10 ++--
.../site_settings/ManageSpaceActivity.java | 6 +--
.../WebContentsDarkModeMessageController.java | 2 +-
.../strings/android_chrome_strings.grd | 2 +
.../ui/android/strings/foundation_e.grdp | 49 +++++++++++++++++++
9 files changed, 69 insertions(+), 15 deletions(-)
create mode 100644 chrome/browser/ui/android/strings/foundation_e.grdp
diff --git a/chrome/android/java/res/layout/manage_space_activity.xml b/chrome/android/java/res/layout/manage_space_activity.xml
index 7361c47c5c675..6f6b5fcfe2f1d 100644
--- a/chrome/android/java/res/layout/manage_space_activity.xml
+++ b/chrome/android/java/res/layout/manage_space_activity.xml
@@ -24,7 +24,7 @@
<!-- ======== 'Unimportant Storage' Info ======== -->
<TextView
android:id="@+id/unimportant_site_data_description"
- android:text="@string/storage_management_unimportant_site_data_description"
+ android:text="@string/storage_management_unimportant_site_data_description_e"
style="@style/ManageSpaceActivityExplanationTextView" />
<LinearLayout
@@ -84,7 +84,7 @@
<TextView
android:id="@+id/all_storage_description"
- android:text="@string/storage_management_all_storage_description"
+ android:text="@string/storage_management_all_storage_description_e"
android:paddingTop="12dp"
style="@style/ManageSpaceActivityExplanationTextView" />
@@ -93,4 +93,4 @@
android:text="@string/storage_management_clear_all_data_button"
style="@style/ManageSpaceActivityButton" />
</LinearLayout>
-</ScrollView>
\ No newline at end of file
+</ScrollView>
diff --git a/chrome/android/java/res/layout/radio_button_group_homepage_preference.xml b/chrome/android/java/res/layout/radio_button_group_homepage_preference.xml
index 35519da5a7e8e..7b65bdf664e29 100644
--- a/chrome/android/java/res/layout/radio_button_group_homepage_preference.xml
+++ b/chrome/android/java/res/layout/radio_button_group_homepage_preference.xml
@@ -33,7 +33,7 @@
android:id="@+id/radio_button_chrome_ntp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- app:primaryText="@string/options_homepage_chrome_homepage" />
+ app:primaryText="@string/options_homepage_chrome_homepage_e" />
<org.chromium.components.browser_ui.widget.RadioButtonWithEditText
android:id="@+id/radio_button_uri_edit"
@@ -43,4 +43,4 @@
android:inputType="textUri" />
</org.chromium.components.browser_ui.widget.RadioButtonWithDescriptionLayout>
-</LinearLayout>
\ No newline at end of file
+</LinearLayout>
diff --git a/chrome/android/java/res/xml/about_chrome_preferences.xml b/chrome/android/java/res/xml/about_chrome_preferences.xml
index 68f0aab29c05d..1808959db4eb9 100644
--- a/chrome/android/java/res/xml/about_chrome_preferences.xml
+++ b/chrome/android/java/res/xml/about_chrome_preferences.xml
@@ -4,6 +4,9 @@
found in the LICENSE file. -->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
+ <Preference
+ android:key="e_browser_information"
+ android:title="@string/e_browser_information_title" />
<Preference
android:key="application_version"
android:title="@string/application_version_title" />
diff --git a/chrome/android/java/res/xml/main_preferences.xml b/chrome/android/java/res/xml/main_preferences.xml
index 82e16ba250327..d404521b5cba3 100644
--- a/chrome/android/java/res/xml/main_preferences.xml
+++ b/chrome/android/java/res/xml/main_preferences.xml
@@ -110,6 +110,6 @@
android:fragment="org.chromium.chrome.browser.about_settings.AboutChromeSettings"
android:key="about_chrome"
android:order="23"
- android:title="@string/prefs_about_chrome"/>
+ android:title="@string/prefs_about_chrome_e"/>
</PreferenceScreen>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/about_settings/AboutChromeSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/about_settings/AboutChromeSettings.java
index c874a07351712..6fd881230db7f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/about_settings/AboutChromeSettings.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/about_settings/AboutChromeSettings.java
@@ -36,7 +36,7 @@ public class AboutChromeSettings
private static final String PREF_APPLICATION_VERSION = "application_version";
private static final String PREF_ALLOW_INLINE_UPDATE = "allow_inline_update";
private static final String PREF_OS_VERSION = "os_version";
- private static final String PREF_LEGAL_INFORMATION = "legal_information";
+ private static final String PREF_E_BROWSER_INFORMATION = "e_browser_information";
// Non-translated strings:
private static final String MSG_DEVELOPER_ENABLE_COUNTDOWN =
@@ -53,7 +53,7 @@ public class AboutChromeSettings
@Override
public void onCreatePreferences(Bundle bundle, String s) {
- getActivity().setTitle(R.string.prefs_about_chrome);
+ getActivity().setTitle(R.string.prefs_about_chrome_e);
SettingsUtils.addPreferencesFromResource(this, R.xml.about_chrome_preferences);
Preference p = findPreference(PREF_APPLICATION_VERSION);
@@ -62,9 +62,9 @@ public class AboutChromeSettings
p.setOnPreferenceClickListener(this);
p = findPreference(PREF_OS_VERSION);
p.setSummary(AboutSettingsBridge.getOSVersion());
- p = findPreference(PREF_LEGAL_INFORMATION);
- int currentYear = Calendar.getInstance().get(Calendar.YEAR);
- p.setSummary(getString(R.string.legal_information_summary, currentYear));
+
+ p = findPreference(PREF_E_BROWSER_INFORMATION);
+ p.setSummary(getString(R.string.e_browser_information));
ChromeSwitchPreference allowInlineUpdate =
(ChromeSwitchPreference) findPreference(PREF_ALLOW_INLINE_UPDATE);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ManageSpaceActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ManageSpaceActivity.java
index a78a720298bb4..69863b791ccc2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ManageSpaceActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ManageSpaceActivity.java
@@ -86,7 +86,7 @@ public class ManageSpaceActivity extends AppCompatActivity implements View.OnCli
setTheme(R.style.ColorOverlay_ChromiumAndroid);
setContentView(R.layout.manage_space_activity);
Resources r = getResources();
- setTitle(String.format(r.getString(R.string.storage_management_activity_label),
+ setTitle(String.format(r.getString(R.string.storage_management_activity_label_e),
r.getString(R.string.app_name)));
mSiteDataSizeText = (TextView) findViewById(R.id.site_data_storage_size_text);
@@ -223,7 +223,7 @@ public class ManageSpaceActivity extends AppCompatActivity implements View.OnCli
});
builder.setNegativeButton(R.string.cancel, null);
builder.setTitle(R.string.storage_clear_site_storage_title);
- builder.setMessage(R.string.storage_management_clear_unimportant_dialog_text);
+ builder.setMessage(R.string.storage_management_clear_unimportant_dialog_text_e);
mUnimportantDialog = builder.create();
}
mUnimportantDialog.show();
@@ -260,7 +260,7 @@ public class ManageSpaceActivity extends AppCompatActivity implements View.OnCli
});
builder.setNegativeButton(R.string.cancel, null);
builder.setTitle(R.string.storage_management_reset_app_dialog_title);
- builder.setMessage(R.string.storage_management_reset_app_dialog_text);
+ builder.setMessage(R.string.storage_management_reset_app_dialog_text_e);
builder.create().show();
}
}
diff --git a/chrome/browser/ui/android/night_mode/java/src/org/chromium/chrome/browser/night_mode/WebContentsDarkModeMessageController.java b/chrome/browser/ui/android/night_mode/java/src/org/chromium/chrome/browser/night_mode/WebContentsDarkModeMessageController.java
index e92bc2b2739c2..af6d85d9da4cd 100644
--- a/chrome/browser/ui/android/night_mode/java/src/org/chromium/chrome/browser/night_mode/WebContentsDarkModeMessageController.java
+++ b/chrome/browser/ui/android/night_mode/java/src/org/chromium/chrome/browser/night_mode/WebContentsDarkModeMessageController.java
@@ -129,7 +129,7 @@ public class WebContentsDarkModeMessageController {
.with(MessageBannerProperties.ICON_TINT_COLOR,
MessageBannerProperties.TINT_NONE)
.with(MessageBannerProperties.TITLE,
- resources.getString(R.string.auto_dark_message_title))
+ resources.getString(R.string.auto_dark_message_title_e))
.with(MessageBannerProperties.DESCRIPTION, description)
.with(MessageBannerProperties.PRIMARY_BUTTON_TEXT,
resources.getString(R.string.auto_dark_message_button))
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd
index 09dbbf7ac668d..af8fdbc61351a 100644
--- a/chrome/browser/ui/android/strings/android_chrome_strings.grd
+++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
@@ -198,6 +198,8 @@ CHAR_LIMIT guidelines:
</translations>
<release seq="1">
<messages fallback_to_english="true">
+ <part file="foundation_e.grdp" />
+
<!-- NOTE: Generic strings used across multiple features belong in //components/browser_ui/strings/android. -->
<!-- Main Preferences -->
diff --git a/chrome/browser/ui/android/strings/foundation_e.grdp b/chrome/browser/ui/android/strings/foundation_e.grdp
new file mode 100644
index 0000000000000..32ad108881f24
--- /dev/null
+++ b/chrome/browser/ui/android/strings/foundation_e.grdp
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="utf-8"?>
+<grit-part>
+
+ <!-- Homepage UI strings -->
+ <message name="IDS_OPTIONS_HOMEPAGE_CHROME_HOMEPAGE_E" desc="The option that allows user to set Chrome's new tab page as the homepage." >
+ Browser’s homepage
+ </message>
+
+ <!-- Tablet UI strings -->
+ <message name="IDS_FORCE_TABLET_UI_SUMMARY_E" desc="Summary of the preference that allows the user to force chromium to use tablet UI.">
+ Open browser in Tablet Mode
+ </message>
+
+ <!-- About UI strings -->
+ <message name="IDS_PREFS_ABOUT_CHROME_E" desc="Title for the About Chrome page. [CHAR-LIMIT=32]">
+ About Browser
+ </message>
+
+ <!-- Storage Preference UI strings for clearing storage. -->
+ <message name="IDS_STORAGE_MANAGEMENT_ACTIVITY_LABEL_E" desc="Title for Chrome's Manage Space Activity.">
+ <ph name="APP_NAME">%1$s<ex>Chrome</ex></ph> storage
+ </message>
+ <message name="IDS_STORAGE_MANAGEMENT_UNIMPORTANT_SITE_DATA_DESCRIPTION_E" desc="Text to describe the data stored by unimportant or infrequent sites.">
+ Stored data that Browser doesn't think is important (e.g. sites with no saved settings or that you don't visit often)
+ </message>
+ <message name="IDS_STORAGE_MANAGEMENT_CLEAR_UNIMPORTANT_DIALOG_TEXT_E" desc="Text of the clear unimportant site data dialog in the storage UI.">
+ This will clear cookies, cache, and other data of sites Browser doesn't think is important.
+ </message>
+ <message name="IDS_STORAGE_MANAGEMENT_ALL_STORAGE_DESCRIPTION_E" desc="Text used to describe all storage space used by Chrome.">
+ Total data used by Browser, including accounts, bookmarks, and saved settings
+ </message>
+ <message name="IDS_STORAGE_MANAGEMENT_RESET_APP_DIALOG_TEXT_E" desc="Text of the reset app dialoag in the storage UI.">
+ All Browser’s app data will be deleted permanently. This includes all files, settings, accounts, databases, etc.
+ </message>
+
+ <!-- About UI strings -->
+ <message name="IDS_E_BROWSER_INFORMATION_TITLE" desc="Title for /e/ Browser information ">
+ /e/ browser information
+ </message>
+ <message name="IDS_E_BROWSER_INFORMATION" desc="/e/ Browser information ">
+ The /e/ browser is a fork of Chromium/Bromite.\n\t\n\tThe Bromite browser:\n\t- offers privacy-compliant search engines by default\n\t- includes several "ungoogling" patches\n\t- offers an Ad-blocker by default\n\t\nThe /e/ browser adds specific settings such as different default search engines, async DNS disabled by default, do-not-track-enabled by default, ...
+ </message>
+
+ <!-- Auto-darken web content -->
+ <message name="IDS_AUTO_DARK_MESSAGE_TITLE_E" desc="Message shown that informs the user auto darkening of website contents has been enabled.">
+ Dark theme for sites is on in Browser
+ </message>
+
+</grit-part>
--
2.25.1
From 40610397927e3e4a6bc520e349cba60a0c715b52 Mon Sep 17 00:00:00 2001
From: Aayush Gupta <theimpulson@e.email>
Date: Fri, 26 Nov 2021 07:29:59 +0000
Subject: [PATCH 06/16] Browser: Point to our default popular sites
Signed-off-by: Aayush Gupta <theimpulson@e.email>
---
.../ntp_tiles/resources/foundation_e.json | 17 +++++++++++++++++
components/resources/ntp_tiles_resources.grdp | 2 +-
2 files changed, 18 insertions(+), 1 deletion(-)
create mode 100644 components/ntp_tiles/resources/foundation_e.json
diff --git a/components/ntp_tiles/resources/foundation_e.json b/components/ntp_tiles/resources/foundation_e.json
new file mode 100644
index 0000000000000..d8a1bcd174ee6
--- /dev/null
+++ b/components/ntp_tiles/resources/foundation_e.json
@@ -0,0 +1,17 @@
+[
+ {
+ "large_icon_url": "https://spot.ecloud.global/static/themes/eelo/img/logo_searx_a.png",
+ "title": "/e/ Spot",
+ "url": "https://spot.ecloud.global/"
+ },
+ {
+ "favicon_url": "https://community.e.foundation/uploads/default/original/1X/281cdc5a2b518e29ee6ca33375e93d4cc6e73f4c.png",
+ "title": "/e/ Community",
+ "url": "https://community.e.foundation/"
+ },
+ {
+ "large_icon_url": "https://e.foundation/wp-content/uploads/logo-black-01.png",
+ "title": "eFoundation",
+ "url": "https://e.foundation/"
+ }
+]
diff --git a/components/resources/ntp_tiles_resources.grdp b/components/resources/ntp_tiles_resources.grdp
index cca535df51c79..493adc3d1809b 100644
--- a/components/resources/ntp_tiles_resources.grdp
+++ b/components/resources/ntp_tiles_resources.grdp
@@ -16,7 +16,7 @@
</then>
<else>
<!-- Fall back to a local resource so popular sites can be tested properly. -->
- <include name="IDR_DEFAULT_POPULAR_SITES_JSON" file="../ntp_tiles/resources/default_popular_sites.json" type="BINDATA" compress="gzip" />
+ <include name="IDR_DEFAULT_POPULAR_SITES_JSON" file="../ntp_tiles/resources/foundation_e.json" type="BINDATA" compress="gzip" />
</else>
</if>
</if>
--
2.25.1
From 153f6beb4938422c02dde55bd27dbe1b5cd4ef3e Mon Sep 17 00:00:00 2001
From: Aayush Gupta <theimpulson@e.email>
Date: Fri, 26 Nov 2021 07:34:57 +0000
Subject: [PATCH 07/16] Browser: Enable do not track by default
Signed-off-by: Aayush Gupta <theimpulson@e.email>
---
chrome/browser/ui/browser_ui_prefs.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/chrome/browser/ui/browser_ui_prefs.cc b/chrome/browser/ui/browser_ui_prefs.cc
index 81c32af81d6a5..868d0d3e9b603 100644
--- a/chrome/browser/ui/browser_ui_prefs.cc
+++ b/chrome/browser/ui/browser_ui_prefs.cc
@@ -88,7 +88,7 @@ void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterDictionaryPref(prefs::kBrowserWindowPlacementPopup);
registry->RegisterDictionaryPref(prefs::kAppWindowPlacement);
registry->RegisterBooleanPref(
- prefs::kEnableDoNotTrack, false,
+ prefs::kEnableDoNotTrack, true,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID)
registry->RegisterBooleanPref(prefs::kPrintPreviewUseSystemDefaultPrinter,
--
2.25.1
From 1ab8dd06262067fe783c68f167a8213bb3246dee Mon Sep 17 00:00:00 2001
From: Aayush Gupta <theimpulson@e.email>
Date: Fri, 26 Nov 2021 08:03:13 +0000
Subject: [PATCH 08/16] Browser: Add provider to share default search engine
Signed-off-by: Aayush Gupta <theimpulson@e.email>
---
chrome/android/java/AndroidManifest.xml | 6 ++
.../provider/SearchEngineProvider.java | 79 +++++++++++++++++++
chrome/android/java_sources.gni | 1 +
3 files changed, 86 insertions(+)
create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/provider/SearchEngineProvider.java
diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml
index c5e9e64823521..16c2479ac3019 100644
--- a/chrome/android/java/AndroidManifest.xml
+++ b/chrome/android/java/AndroidManifest.xml
@@ -1259,6 +1259,12 @@ by a child template that "extends" this file.
android:readPermission="android.permission.GLOBAL_SEARCH" />
</provider>
+ <!-- Provider for search engine data. -->
+ <provider android:name="org.chromium.chrome.browser.provider.SearchEngineProvider"
+ android:authorities="foundation.e.browser.provider"
+ android:exported="true" >
+ </provider>
+
{% block base_application_definitions %}
{% endblock %}
{% block extra_application_definitions_for_test %}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/provider/SearchEngineProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/provider/SearchEngineProvider.java
new file mode 100644
index 0000000000000..299562413fe05
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/provider/SearchEngineProvider.java
@@ -0,0 +1,79 @@
+package org.chromium.chrome.browser.provider;
+
+
+import android.content.ContentProvider;
+import android.content.ContentResolver;
+import android.content.ContentValues;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.content.UriMatcher;
+import android.database.Cursor;
+import android.database.MatrixCursor;
+import android.net.Uri;
+import androidx.annotation.NonNull;
+
+public class SearchEngineProvider extends ContentProvider {
+
+ public static final String CONFIGURATION_PREFERENCE_FILE_NAME = "foundation.e.browser_preferences";
+
+ public static final String AUTHORITY = "foundation.e.browser.provider";
+
+ private static final int MATCH_DATA = 0x010000;
+
+ private static UriMatcher matcher;
+
+ private static final String PREFERENCE_KEY = "org.chromium.chrome.browser.searchwidget.SEARCH_ENGINE_SHORTNAME";
+
+ private static void init(){
+ matcher = new UriMatcher(UriMatcher.NO_MATCH);
+ matcher.addURI(AUTHORITY, "search_engine", MATCH_DATA);
+ }
+
+ @Override
+ public boolean onCreate() {
+ if(matcher == null){
+ init();
+ }
+ return true;
+ }
+
+ @Override
+ public String getType(@NonNull Uri uri) {
+ return ContentResolver.CURSOR_ITEM_BASE_TYPE + "/vnd." + AUTHORITY + ".item";
+ }
+
+ @Override
+ public int delete(@NonNull Uri uri, String selection, String[] selectionArgs) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Uri insert(@NonNull Uri uri, ContentValues values) {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public Cursor query(@NonNull Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {
+ //Provide a read only access to the content provider
+ MatrixCursor cursor;
+ if (matcher.match(uri) == MATCH_DATA) {
+ cursor = new MatrixCursor(new String[]{PREFERENCE_KEY});
+ MatrixCursor.RowBuilder rowBuilder = cursor.newRow();
+ SharedPreferences sharedPreferences = getContext().getSharedPreferences(
+ CONFIGURATION_PREFERENCE_FILE_NAME, Context.MODE_PRIVATE);
+ if (sharedPreferences != null) {
+ rowBuilder.add(sharedPreferences.getString(PREFERENCE_KEY, ""));
+ } else {
+ rowBuilder.add("");
+ }
+ } else {
+ throw new IllegalArgumentException("Unsupported uri " + uri);
+ }
+ return cursor;
+ }
+
+ @Override
+ public int update(@NonNull Uri uri, ContentValues values, String selection, String[] selectionArgs) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/chrome/android/java_sources.gni b/chrome/android/java_sources.gni
index c4e4b7360ecd2..697a0e4ef4ad3 100644
--- a/chrome/android/java_sources.gni
+++ b/chrome/android/java_sources.gni
@@ -62,3 +62,4 @@ if (enable_arcore) {
}
chrome_java_sources += userscripts_java_sources
+chrome_java_sources += [ "java/src/org/chromium/chrome/browser/provider/SearchEngineProvider.java" ]
--
2.25.1
From 8985ab18036ab8756ac52c47dca7b087e0b3a109 Mon Sep 17 00:00:00 2001
From: Aayush Gupta <aayushgupta219@gmail.com>
Date: Mon, 29 Nov 2021 03:37:37 +0000
Subject: [PATCH 09/16] Browser: Enable custom tabs by default
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
---
chrome/android/java/res/xml/privacy_preferences.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml
index 4f5751b297aba..92c13bd579f6b 100644
--- a/chrome/android/java/res/xml/privacy_preferences.xml
+++ b/chrome/android/java/res/xml/privacy_preferences.xml
@@ -70,7 +70,7 @@
android:key="allow_custom_tab_intents"
android:title="@string/allow_custom_tab_intents_title"
android:summary="@string/allow_custom_tab_intents_summary"
- android:defaultValue="false" />
+ android:defaultValue="true" />
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
android:key="open_external_links_incognito"
android:title="@string/open_external_links_incognito_title"
--
2.25.1
From 4be5068cdc66b196617c7256fb30f1ccd1d14dc6 Mon Sep 17 00:00:00 2001
From: Aayush Gupta <aayushgupta219@gmail.com>
Date: Mon, 29 Nov 2021 03:39:21 +0000
Subject: [PATCH 10/16] Browser: Enable search suggestion by default
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
---
chrome/browser/profiles/profile.cc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/chrome/browser/profiles/profile.cc b/chrome/browser/profiles/profile.cc
index ac4c9d25ccd8b..c196f5d2fe85a 100644
--- a/chrome/browser/profiles/profile.cc
+++ b/chrome/browser/profiles/profile.cc
@@ -275,7 +275,7 @@ const char Profile::kProfileKey[] = "__PROFILE__";
void Profile::RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) {
registry->RegisterBooleanPref(
prefs::kSearchSuggestEnabled,
- false,
+ true,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
#if BUILDFLAG(IS_ANDROID)
registry->RegisterStringPref(
--
2.25.1
This diff is collapsed.
From 1cf529a6facacebbbb16c687c9fac2799c9afa14 Mon Sep 17 00:00:00 2001
From: Aayush Gupta <theimpulson@e.email>
Date: Tue, 11 May 2021 14:22:00 +0200