add Force-open-external-links-in-incognito.patch
This commit is contained in:
parent
07d13a350b
commit
4790001da5
2 changed files with 68 additions and 0 deletions
|
@ -157,4 +157,5 @@ API-level-21-prevent-crash-on-download.patch
|
|||
Add-vibration-flag.patch
|
||||
mime_util-force-text-x-suse-ymp-to-be-downloaded.patch
|
||||
Disable-UA-client-hint.patch
|
||||
Force-open-external-links-in-incognito.patch
|
||||
Automated-domain-substitution.patch
|
||||
|
|
67
build/patches/Force-open-external-links-in-incognito.patch
Normal file
67
build/patches/Force-open-external-links-in-incognito.patch
Normal file
|
@ -0,0 +1,67 @@
|
|||
From: uazo <uazo@users.noreply.github.com>
|
||||
Date: Mon, 4 Oct 2021 11:48:18 +0000
|
||||
Subject: Force open external links in incognito
|
||||
|
||||
---
|
||||
chrome/android/java/res/xml/privacy_preferences.xml | 5 +++++
|
||||
.../chrome/browser/LaunchIntentDispatcher.java | 11 +++++++++++
|
||||
.../ui/android/strings/android_chrome_strings.grd | 8 ++++++++
|
||||
3 files changed, 24 insertions(+)
|
||||
|
||||
diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
--- a/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
+++ b/chrome/android/java/res/xml/privacy_preferences.xml
|
||||
@@ -57,6 +57,11 @@
|
||||
android:title="@string/allow_custom_tab_intents_title"
|
||||
android:summary="@string/allow_custom_tab_intents_summary"
|
||||
android:defaultValue="false" />
|
||||
+ <org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
||||
+ android:key="open_external_links_incognito"
|
||||
+ android:title="@string/open_external_links_incognito_title"
|
||||
+ android:summary="@string/open_external_links_incognito_summary"
|
||||
+ android:defaultValue="false" />
|
||||
<Preference
|
||||
android:key="privacy_sandbox"
|
||||
android:title="@string/prefs_privacy_sandbox"
|
||||
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java b/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
|
||||
--- a/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
|
||||
+++ b/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java
|
||||
@@ -427,6 +427,17 @@ public class LaunchIntentDispatcher implements IntentHandler.IntentHandlerDelega
|
||||
|
||||
if (Intent.ACTION_VIEW.equals(newIntent.getAction())
|
||||
&& !IntentHandler.wasIntentSenderChrome(newIntent)) {
|
||||
+
|
||||
+ if (ContextUtils.getAppSharedPreferences().getBoolean(
|
||||
+ "open_external_links_incognito", false)) {
|
||||
+ Context applicationContext = ContextUtils.getApplicationContext();
|
||||
+ newIntent = IntentHandler.createTrustedOpenNewTabIntent(applicationContext,
|
||||
+ /*incognito*/true);
|
||||
+ newIntent.setData(mIntent.getData());
|
||||
+ newIntent.setPackage(applicationContext.getPackageName());
|
||||
+ newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
+ }
|
||||
+
|
||||
long time = SystemClock.elapsedRealtime();
|
||||
if (!chromeTabbedTaskExists()) {
|
||||
newIntent.putExtra(IntentHandler.EXTRA_STARTED_TABBED_CHROME_TASK, true);
|
||||
diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd
|
||||
--- a/chrome/browser/ui/android/strings/android_chrome_strings.grd
|
||||
+++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd
|
||||
@@ -4330,6 +4330,14 @@ To change this setting, <ph name="BEGIN_LINK"><resetlink></ph>reset sync<p
|
||||
Allow applications to open custom tab intents, similar to webview.
|
||||
</message>
|
||||
|
||||
+ <!-- Open External Links in Incognito -->
|
||||
+ <message name="IDS_OPEN_EXTERNAL_LINKS_INCOGNITO_TITLE" desc="Text for 'Open external links in incognito' settings-privacy option.">
|
||||
+ Open external links in incognito
|
||||
+ </message>
|
||||
+ <message name="IDS_OPEN_EXTERNAL_LINKS_INCOGNITO_SUMMARY" desc="Summary text for 'Open external links in incognito' settings-privacy option.">
|
||||
+ Force the opening of all external links in incognito mode
|
||||
+ </message>
|
||||
+
|
||||
<!-- Autofill Assistant preferences -->
|
||||
<!-- TODO(b/168178344): Move to Assistant settings strings section below. -->
|
||||
<message name="IDS_PREFS_AUTOFILL_ASSISTANT_TITLE" desc="Title for the Autofill Assistant preferences screen. [CHAR_LIMIT=32]">
|
||||
--
|
||||
2.17.1
|
||||
|
Loading…
Add table
Reference in a new issue