446 lines
26 KiB
Diff
446 lines
26 KiB
Diff
From: csagan5 <32685696+csagan5@users.noreply.github.com>
|
|
Date: Wed, 29 Aug 2018 11:03:44 +0200
|
|
Subject: Add custom tab intents privacy option
|
|
|
|
Add custom tab intents privacy option and force
|
|
open external links in incognito flag.
|
|
Use the CCT ephemeral mode.
|
|
|
|
Flags are mutually exclusive.
|
|
|
|
See also: https://github.com/bromite/bromite/issues/1474
|
|
|
|
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
|
|
---
|
|
.../java/res/xml/privacy_preferences.xml | 15 ++++++
|
|
.../browser/LaunchIntentDispatcher.java | 22 ++++++++
|
|
.../CustomTabIntentDataProvider.java | 22 ++++----
|
|
.../customtabs/CustomTabsConnection.java | 3 +-
|
|
.../IncognitoCustomTabIntentDataProvider.java | 14 +++++
|
|
.../privacy/settings/PrivacySettings.java | 51 +++++++++++++++++++
|
|
.../flags/android/chrome_feature_list.cc | 4 +-
|
|
.../browser/flags/ChromeFeatureList.java | 3 ++
|
|
.../chrome/browser/tab/TabAssociatedApp.java | 6 ++-
|
|
...Add-custom-tab-intents-privacy-option.grdp | 25 +++++++++
|
|
.../OriginVerifier.java | 5 ++
|
|
.../core/common/language_experiments.cc | 1 +
|
|
.../add-custom-tab-intents-privacy-option.inc | 1 +
|
|
13 files changed, 159 insertions(+), 13 deletions(-)
|
|
create mode 100644 chrome/browser/ui/android/strings/cromite_android_chrome_strings_grd/Add-custom-tab-intents-privacy-option.grdp
|
|
create mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-custom-tab-intents-privacy-option.inc
|
|
|
|
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
|
|
@@ -40,6 +40,21 @@ found in the LICENSE file.
|
|
android:key="cromite_flags"
|
|
android:title="@string/cromite_flags_title"
|
|
app:url="@string/cromite_flags_url" />
|
|
+ <org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
|
+ 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" />
|
|
+ <org.chromium.components.browser_ui.settings.ChromeSwitchPreference
|
|
+ android:title="@string/uses_separate_storagepartition_for_cct_title"
|
|
+ android:summary="@string/uses_separate_storagepartition_for_cct_summary"
|
|
+ app:featureName="maylaunchurl-uses-separate-storage-partition"
|
|
+ app:needRestart="true" />
|
|
+ <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="preload_pages"
|
|
android:title="@string/preload_pages_title"
|
|
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
|
|
@@ -23,6 +23,7 @@ import androidx.core.os.BuildCompat;
|
|
import org.chromium.base.ApiCompatibilityUtils;
|
|
import org.chromium.base.ApplicationStatus;
|
|
import org.chromium.base.CommandLine;
|
|
+import org.chromium.base.ContextUtils;
|
|
import org.chromium.base.IntentUtils;
|
|
import org.chromium.base.Log;
|
|
import org.chromium.base.metrics.RecordHistogram;
|
|
@@ -53,6 +54,9 @@ import java.lang.annotation.Retention;
|
|
import java.lang.annotation.RetentionPolicy;
|
|
import java.util.Set;
|
|
|
|
+import org.chromium.chrome.browser.privacy.settings.PrivacySettings;
|
|
+import org.chromium.chrome.browser.tab.TabLaunchType;
|
|
+
|
|
/**
|
|
* Dispatches incoming intents to the appropriate activity based on the current configuration and
|
|
* Intent fired.
|
|
@@ -139,6 +143,9 @@ public class LaunchIntentDispatcher {
|
|
*/
|
|
public static boolean isCustomTabIntent(Intent intent) {
|
|
if (intent == null) return false;
|
|
+ if (!ContextUtils.getAppSharedPreferences()
|
|
+ .getBoolean(PrivacySettings.PREF_ALLOW_CUSTOM_TAB_INTENTS, false))
|
|
+ return false;
|
|
Log.w(
|
|
TAG,
|
|
"CustomTabsIntent#shouldAlwaysUseBrowserUI() = "
|
|
@@ -165,6 +172,10 @@ public class LaunchIntentDispatcher {
|
|
// Make sure the result of the CustomTabActivity is forwarded to the client.
|
|
newIntent.addFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
|
|
|
|
+ if (ContextUtils.getAppSharedPreferences()
|
|
+ .getBoolean(PrivacySettings.PREF_OPEN_EXTERNAL_LINKS_INCOGNITO, false))
|
|
+ newIntent.putExtra(IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, true);
|
|
+
|
|
// Since configureIntentForResizableCustomTab() might change the componenet/class
|
|
// associated with the passed intent, it needs to be called after #setClassName(context,
|
|
// CustomTabActivity.class.getName());
|
|
@@ -342,6 +353,17 @@ public class LaunchIntentDispatcher {
|
|
|
|
if (Intent.ACTION_VIEW.equals(newIntent.getAction())
|
|
&& !IntentHandler.wasIntentSenderChrome(newIntent)) {
|
|
+
|
|
+ if (ContextUtils.getAppSharedPreferences().getBoolean(
|
|
+ PrivacySettings.PREF_OPEN_EXTERNAL_LINKS_INCOGNITO, false)) {
|
|
+ Context applicationContext = ContextUtils.getApplicationContext();
|
|
+ newIntent = IntentHandler.createTrustedOpenNewTabIntent(applicationContext,
|
|
+ /*incognito*/true);
|
|
+ newIntent.setData(mIntent.getData());
|
|
+ newIntent.setPackage(applicationContext.getPackageName());
|
|
+ IntentHandler.setTabLaunchType(newIntent, TabLaunchType.FROM_EXTERNAL_APP);
|
|
+ newIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
+ }
|
|
if (!chromeTabbedTaskExists(mActivity)) {
|
|
newIntent.putExtra(IntentHandler.EXTRA_STARTED_TABBED_CHROME_TASK, true);
|
|
}
|
|
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
|
|
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
|
|
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
|
|
@@ -248,16 +248,16 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid
|
|
|
|
// Extra whose value is an array of ints that is supplied to
|
|
// SyntheticTrialRegistry::RegisterExternalExperiments().
|
|
- public static final String EXPERIMENT_IDS =
|
|
- "org.chromium.chrome.browser.customtabs.AGA_EXPERIMENT_IDS";
|
|
+ // public static final String EXPERIMENT_IDS =
|
|
+ // "org.chromium.chrome.browser.customtabs.AGA_EXPERIMENT_IDS";
|
|
|
|
// These Extra Intent parameters allow an Intent to enable or disable a set of Features.
|
|
// The set of Features that may be enabled or disabled is restricted by the code,
|
|
// and initially only two Features may be enabled together, or disabled together.
|
|
- public static final String EXPERIMENTS_ENABLE =
|
|
- "org.chromium.chrome.browser.customtabs.EXPERIMENTS_ENABLE";
|
|
- public static final String EXPERIMENTS_DISABLE =
|
|
- "org.chromium.chrome.browser.customtabs.EXPERIMENTS_DISABLE";
|
|
+ // public static final String EXPERIMENTS_ENABLE =
|
|
+ // "org.chromium.chrome.browser.customtabs.EXPERIMENTS_ENABLE";
|
|
+ // public static final String EXPERIMENTS_DISABLE =
|
|
+ // "org.chromium.chrome.browser.customtabs.EXPERIMENTS_DISABLE";
|
|
|
|
/**
|
|
* Extra that, if set, makes the Custom Tab Activity's height to be x pixels, the Custom Tab
|
|
@@ -727,7 +727,7 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid
|
|
TrustedWebActivityIntentBuilder.EXTRA_SCREEN_ORIENTATION,
|
|
ScreenOrientation.DEFAULT));
|
|
|
|
- mGsaExperimentIds = IntentUtils.safeGetIntArrayExtra(intent, EXPERIMENT_IDS);
|
|
+ mGsaExperimentIds = null; //IntentUtils.safeGetIntArrayExtra(intent, EXPERIMENT_IDS);
|
|
|
|
mBreakPointDp = getActivityBreakPointFromIntent(intent);
|
|
mInitialActivityHeight = getInitialActivityHeightFromIntent(intent);
|
|
@@ -740,8 +740,8 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid
|
|
intent, EXTRA_ACTIVITY_HEIGHT_RESIZE_BEHAVIOR, ACTIVITY_HEIGHT_DEFAULT);
|
|
mIsPartialCustomTabFixedHeight = activityHeightResizeBehavior == ACTIVITY_HEIGHT_FIXED;
|
|
|
|
- mInteractWithBackground = CustomTabsIntent.isBackgroundInteractionEnabled(intent);
|
|
- if (IntentUtils.safeHasExtra(intent, EXTRA_ENABLE_BACKGROUND_INTERACTION)) {
|
|
+ mInteractWithBackground = false; // CustomTabsIntent.isBackgroundInteractionEnabled(intent);
|
|
+ if (((false)) && IntentUtils.safeHasExtra(intent, EXTRA_ENABLE_BACKGROUND_INTERACTION)) {
|
|
@BackgroundInteractBehavior
|
|
int backgroundInteractBehavior =
|
|
IntentUtils.safeGetIntExtra(
|
|
@@ -1410,7 +1410,9 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid
|
|
public @CustomTabProfileType int getCustomTabMode() {
|
|
return AlwaysIncognitoLinkInterceptor.isAlwaysIncognito()
|
|
? CustomTabProfileType.INCOGNITO
|
|
- : CustomTabProfileType.REGULAR;
|
|
+ : (ChromeFeatureList.sMayLaunchurlUsesSeparateStoragePartition.isEnabled()
|
|
+ ? CustomTabProfileType.EPHEMERAL
|
|
+ : CustomTabProfileType.REGULAR);
|
|
}
|
|
|
|
@Override
|
|
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
|
|
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
|
|
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java
|
|
@@ -786,7 +786,7 @@ public class CustomTabsConnection {
|
|
ThreadUtils.assertOnUiThread();
|
|
if (extras == null) return;
|
|
int[] experimentIds =
|
|
- IntentUtils.safeGetIntArray(extras, CustomTabIntentDataProvider.EXPERIMENT_IDS);
|
|
+ null; //IntentUtils.safeGetIntArray(extras, CustomTabIntentDataProvider.EXPERIMENT_IDS);
|
|
if (experimentIds == null) return;
|
|
// When ids are set through cct, they should not override existing ids.
|
|
boolean override = false;
|
|
@@ -1003,6 +1003,7 @@ public class CustomTabsConnection {
|
|
PostTask.postTask(
|
|
TaskTraits.UI_DEFAULT,
|
|
() -> {
|
|
+ if ((true)) return; // Disable CCTPostMessageAPI
|
|
// Attempt to verify origin synchronously. If successful directly initialize
|
|
// postMessage channel for session.
|
|
Uri verifiedOrigin = verifyOriginForSession(session, uid, postMessageOrigin);
|
|
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java
|
|
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java
|
|
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java
|
|
@@ -45,6 +45,9 @@ import org.chromium.components.browser_ui.widget.TintedDrawable;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
+import org.chromium.base.ContextUtils;
|
|
+import org.chromium.chrome.browser.privacy.settings.PrivacySettings;
|
|
+
|
|
/**
|
|
* A model class that parses the incoming intent for incognito Custom Tabs specific customization
|
|
* data.
|
|
@@ -134,6 +137,9 @@ public class IncognitoCustomTabIntentDataProvider extends BrowserServicesIntentD
|
|
}
|
|
|
|
private static boolean isIntentFromThirdPartyAllowed() {
|
|
+ if (ContextUtils.getAppSharedPreferences()
|
|
+ .getBoolean(PrivacySettings.PREF_OPEN_EXTERNAL_LINKS_INCOGNITO, false))
|
|
+ return true;
|
|
return ChromeFeatureList.sCctIncognitoAvailableToThirdParty.isEnabled();
|
|
}
|
|
|
|
@@ -231,6 +237,10 @@ public class IncognitoCustomTabIntentDataProvider extends BrowserServicesIntentD
|
|
}
|
|
|
|
public static boolean isValidIncognitoIntent(Intent intent, boolean recordMetrics) {
|
|
+ if (ContextUtils.getAppSharedPreferences()
|
|
+ .getBoolean(PrivacySettings.PREF_OPEN_EXTERNAL_LINKS_INCOGNITO, false)) {
|
|
+ return true;
|
|
+ }
|
|
if (!isIncognitoRequested(intent)) return false;
|
|
var session = SessionHolder.getSessionHolderFromIntent(intent);
|
|
if (isIntentFromThirdPartyAllowed()
|
|
@@ -341,6 +351,10 @@ public class IncognitoCustomTabIntentDataProvider extends BrowserServicesIntentD
|
|
|
|
@Override
|
|
public @CustomTabProfileType int getCustomTabMode() {
|
|
+ if (ContextUtils.getAppSharedPreferences()
|
|
+ .getBoolean(PrivacySettings.PREF_OPEN_EXTERNAL_LINKS_INCOGNITO, false)) {
|
|
+ return CustomTabProfileType.EPHEMERAL;
|
|
+ }
|
|
return CustomTabProfileType.INCOGNITO;
|
|
}
|
|
|
|
diff --git 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
|
|
--- 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
|
|
@@ -12,6 +12,7 @@ import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.content.SharedPreferences;
|
|
import android.graphics.drawable.Drawable;
|
|
+import android.os.Build;
|
|
import android.os.Bundle;
|
|
import android.text.SpannableString;
|
|
import android.text.SpannableStringBuilder;
|
|
@@ -88,6 +89,15 @@ import org.chromium.ui.widget.ChromeBulletSpan;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.function.Consumer;
|
|
|
|
+import android.app.role.RoleManager;
|
|
+import android.content.Context;
|
|
+import android.content.Intent;
|
|
+import android.content.pm.ResolveInfo;
|
|
+import android.provider.Settings;
|
|
+import android.text.TextUtils;
|
|
+import org.chromium.base.IntentUtils;
|
|
+import org.chromium.base.PackageManagerUtils;
|
|
+
|
|
import androidx.preference.PreferenceCategory;
|
|
import org.chromium.chrome.browser.contextualsearch.ContextualSearchManager;
|
|
import org.chromium.base.shared_preferences.SharedPreferencesManager;
|
|
@@ -163,6 +173,9 @@ public class PrivacySettings extends ChromeBaseSettingsFragment
|
|
startTag, endTag, new ChromeClickableSpan(context, onClickCallback));
|
|
}
|
|
|
|
+ private ChromeSwitchPreference allowCustomTabIntentsPref;
|
|
+ private ChromeSwitchPreference openExternalLinksPref;
|
|
+
|
|
@Override
|
|
public void onCreatePreferencesCromite(@Nullable Bundle savedInstanceState, @Nullable String rootKey) {
|
|
mPageTitle.set(getString(R.string.prefs_privacy_security));
|
|
@@ -420,6 +433,9 @@ public class PrivacySettings extends ChromeBaseSettingsFragment
|
|
new SpanApplier.SpanInfo("<link2>", "</link2>", servicesLink));
|
|
}
|
|
|
|
+ public static final String PREF_ALLOW_CUSTOM_TAB_INTENTS = "allow_custom_tab_intents";
|
|
+ public static final String PREF_OPEN_EXTERNAL_LINKS_INCOGNITO = "open_external_links_incognito";
|
|
+
|
|
@Override
|
|
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
|
String key = preference.getKey();
|
|
@@ -440,6 +456,31 @@ public class PrivacySettings extends ChromeBaseSettingsFragment
|
|
} else if (PREF_SEARCH_SUGGESTIONS.equals(key)) {
|
|
UserPrefs.get(getProfile())
|
|
.setBoolean(Pref.SEARCH_SUGGEST_ENABLED, (boolean) newValue);
|
|
+ } else if (PREF_ALLOW_CUSTOM_TAB_INTENTS.equals(key)) {
|
|
+ SharedPreferences.Editor sharedPreferencesEditor = ContextUtils.getAppSharedPreferences().edit();
|
|
+ sharedPreferencesEditor.putBoolean(PREF_ALLOW_CUSTOM_TAB_INTENTS, (boolean)newValue);
|
|
+ sharedPreferencesEditor.apply();
|
|
+ // check default browser
|
|
+ if ((boolean)newValue) {
|
|
+ ResolveInfo info = PackageManagerUtils.resolveDefaultWebBrowserActivity();
|
|
+ if (info == null || info.match == 0 ||
|
|
+ !TextUtils.equals(ContextUtils.getApplicationContext().getPackageName(),
|
|
+ info.activityInfo.packageName)) {
|
|
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
+ RoleManager roleManager = (RoleManager) getContext().getSystemService(Context.ROLE_SERVICE);
|
|
+ Intent intent = roleManager.createRequestRoleIntent(RoleManager.ROLE_BROWSER);
|
|
+ startActivityForResult(intent, 0);
|
|
+ } else {
|
|
+ Intent intent = new Intent(Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS);
|
|
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
+ IntentUtils.safeStartActivity(getContext(), intent);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ } else if (PREF_OPEN_EXTERNAL_LINKS_INCOGNITO.equals(key)) {
|
|
+ SharedPreferences.Editor sharedPreferencesEditor = ContextUtils.getAppSharedPreferences().edit();
|
|
+ sharedPreferencesEditor.putBoolean(PREF_OPEN_EXTERNAL_LINKS_INCOGNITO, (boolean)newValue);
|
|
+ sharedPreferencesEditor.apply();
|
|
}
|
|
return true;
|
|
}
|
|
@@ -472,6 +513,16 @@ public class PrivacySettings extends ChromeBaseSettingsFragment
|
|
UserPrefs.get(getProfile()).getBoolean(Pref.CAN_MAKE_PAYMENT_ENABLED));
|
|
}
|
|
|
|
+ allowCustomTabIntentsPref =
|
|
+ (ChromeSwitchPreference) findPreference(PREF_ALLOW_CUSTOM_TAB_INTENTS);
|
|
+ allowCustomTabIntentsPref.setOnPreferenceChangeListener(this);
|
|
+ allowCustomTabIntentsPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
|
|
+
|
|
+ openExternalLinksPref =
|
|
+ (ChromeSwitchPreference) findPreference(PREF_OPEN_EXTERNAL_LINKS_INCOGNITO);
|
|
+ openExternalLinksPref.setOnPreferenceChangeListener(this);
|
|
+ openExternalLinksPref.setManagedPreferenceDelegate(mManagedPreferenceDelegate);
|
|
+
|
|
Preference doNotTrackPref = findPreference(PREF_DO_NOT_TRACK);
|
|
if (doNotTrackPref != null) {
|
|
doNotTrackPref.setSummary(
|
|
diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc
|
|
--- a/chrome/browser/flags/android/chrome_feature_list.cc
|
|
+++ b/chrome/browser/flags/android/chrome_feature_list.cc
|
|
@@ -741,7 +741,9 @@ BASE_FEATURE(kLogoViewRefactor, base::FEATURE_DISABLED_BY_DEFAULT);
|
|
// Enables an experimental feature which forces mayLaunchUrl to use a different
|
|
// storage partition. This may reduce performance. This should not be enabled by
|
|
// default.
|
|
-BASE_FEATURE(kMayLaunchUrlUsesSeparateStoragePartition, base::FEATURE_DISABLED_BY_DEFAULT);
|
|
+CROMITE_FEATURE(kMayLaunchUrlUsesSeparateStoragePartition,
|
|
+ "MayLaunchUrlUsesSeparateStoragePartition",
|
|
+ base::FEATURE_DISABLED_BY_DEFAULT);
|
|
BASE_FEATURE(kMediaIndicatorsAndroid, base::FEATURE_DISABLED_BY_DEFAULT);
|
|
BASE_FEATURE(kMostVisitedTilesCustomization, base::FEATURE_ENABLED_BY_DEFAULT);
|
|
BASE_FEATURE(kMostVisitedTilesReselect, base::FEATURE_DISABLED_BY_DEFAULT);
|
|
diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
|
|
--- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
|
|
+++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java
|
|
@@ -1053,6 +1053,8 @@ public abstract class ChromeFeatureList {
|
|
MOST_VISITED_TILES_CUSTOMIZATION,
|
|
/* defaultValue= */ true,
|
|
/* defaultValueInTests= */ true);
|
|
+ public static final CachedFlag sMayLaunchurlUsesSeparateStoragePartition =
|
|
+ newCachedFlag(MAYLAUNCHURL_USES_SEPARATE_STORAGE_PARTITION, false);
|
|
public static final CachedFlag sMostVisitedTilesReselect =
|
|
newCachedFlag(MOST_VISITED_TILES_RESELECT, false);
|
|
public static final CachedFlag sMoveToFrontInLaunchIntentDispatcher =
|
|
@@ -1330,6 +1332,7 @@ public abstract class ChromeFeatureList {
|
|
sMaliciousApkDownloadCheck,
|
|
sMostVisitedTilesCustomization,
|
|
sMostVisitedTilesReselect,
|
|
+ sMayLaunchurlUsesSeparateStoragePartition,
|
|
sMoveToFrontInLaunchIntentDispatcher,
|
|
sMultiInstanceSharedPrefsMigration,
|
|
sMvcUpdateViewWhenModelChanged,
|
|
diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabAssociatedApp.java b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabAssociatedApp.java
|
|
--- a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabAssociatedApp.java
|
|
+++ b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabAssociatedApp.java
|
|
@@ -90,7 +90,11 @@ public final class TabAssociatedApp extends TabWebContentsUserData implements Im
|
|
public static boolean isOpenedFromExternalApp(Tab tab) {
|
|
TabAssociatedApp app = get(tab);
|
|
if (app == null) return false;
|
|
-
|
|
+ if (ContextUtils.getAppSharedPreferences()
|
|
+ .getBoolean("open_external_links_incognito", false) &&
|
|
+ tab.isIncognito() &&
|
|
+ tab.getLaunchType() == TabLaunchType.FROM_EXTERNAL_APP)
|
|
+ return true;
|
|
String packageName = ContextUtils.getApplicationContext().getPackageName();
|
|
return tab.getLaunchType() == TabLaunchType.FROM_EXTERNAL_APP
|
|
&& !TextUtils.equals(app.getAppId(), packageName);
|
|
diff --git a/chrome/browser/ui/android/strings/cromite_android_chrome_strings_grd/Add-custom-tab-intents-privacy-option.grdp b/chrome/browser/ui/android/strings/cromite_android_chrome_strings_grd/Add-custom-tab-intents-privacy-option.grdp
|
|
new file mode 100644
|
|
--- /dev/null
|
|
+++ b/chrome/browser/ui/android/strings/cromite_android_chrome_strings_grd/Add-custom-tab-intents-privacy-option.grdp
|
|
@@ -0,0 +1,25 @@
|
|
+<?xml version="1.0" encoding="utf-8"?>
|
|
+<grit-part>
|
|
+ <!-- Allow custom tab intents -->
|
|
+ <message name="IDS_ALLOW_CUSTOM_TAB_INTENTS_TITLE" desc="Text for 'Allow custom tab intents' settings-privacy option.">
|
|
+ Allow custom tab intents.
|
|
+ </message>
|
|
+ <message name="IDS_ALLOW_CUSTOM_TAB_INTENTS_SUMMARY" desc="Summary text for 'Allow custom tab intents' settings-privacy option.">
|
|
+ Allow applications to open custom tab intents, similar to webview. To work, Cromite must be set as the default browser.
|
|
+ </message>
|
|
+
|
|
+ <message name="IDS_USES_SEPARATE_STORAGEPARTITION_FOR_CCT_TITLE" desc="Text for 'Use ephemeral mode for CCT' settings-privacy option.">
|
|
+ Use ephemeral mode for CCT
|
|
+ </message>
|
|
+ <message name="IDS_USES_SEPARATE_STORAGEPARTITION_FOR_CCT_SUMMARY" desc="Summary text for 'Use ephemeral mode for CCT' settings-privacy option.">
|
|
+ Use a separate storage partition when opening custom tab intents
|
|
+ </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 and uses the CCT ephemeral mode. Caution: there is only one incognito profile.
|
|
+ </message>
|
|
+</grit-part>
|
|
diff --git a/components/content_relationship_verification/android/java/src/org/chromium/components/content_relationship_verification/OriginVerifier.java b/components/content_relationship_verification/android/java/src/org/chromium/components/content_relationship_verification/OriginVerifier.java
|
|
--- a/components/content_relationship_verification/android/java/src/org/chromium/components/content_relationship_verification/OriginVerifier.java
|
|
+++ b/components/content_relationship_verification/android/java/src/org/chromium/components/content_relationship_verification/OriginVerifier.java
|
|
@@ -181,6 +181,11 @@ public abstract class OriginVerifier {
|
|
assert mNativeOriginVerifier != 0
|
|
: "Either provide a browserContextHandle to "
|
|
+ "OriginVerifier#ctor or call initNativeOriginVerifier.";
|
|
+ if ((true)) {
|
|
+ PostTask.runOrPostTask(
|
|
+ TaskTraits.UI_DEFAULT, new VerifiedCallback(origin, false, null));
|
|
+ return;
|
|
+ }
|
|
|
|
String scheme = origin.uri().getScheme();
|
|
String host = assumeNonNull(origin.uri().getHost());
|
|
diff --git a/components/language/core/common/language_experiments.cc b/components/language/core/common/language_experiments.cc
|
|
--- a/components/language/core/common/language_experiments.cc
|
|
+++ b/components/language/core/common/language_experiments.cc
|
|
@@ -20,4 +20,5 @@ BASE_FEATURE(kTranslateOpenSettings, base::FEATURE_DISABLED_BY_DEFAULT);
|
|
|
|
BASE_FEATURE(kDisableGeoLanguageModel, base::FEATURE_ENABLED_BY_DEFAULT);
|
|
|
|
+SET_CROMITE_FEATURE_DISABLED(kCctAutoTranslate);
|
|
} // namespace language
|
|
diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-custom-tab-intents-privacy-option.inc b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-custom-tab-intents-privacy-option.inc
|
|
new file mode 100644
|
|
--- /dev/null
|
|
+++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-custom-tab-intents-privacy-option.inc
|
|
@@ -0,0 +1 @@
|
|
+// explicitly empty
|
|
--
|