Commit de58c823 authored by Peter E Conn's avatar Peter E Conn Committed by Commit Bot

📎 Remove unneeded TWA feature flags.

Trusted Web Activities have been launched since Chrome 72 and
Permission Auto-Enrolment has been launched since Chrome 75.

Bug: 1017688
Change-Id: I98420357ee6fee95ef78df85a55f48f3f897695d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1878199
Commit-Queue: Peter Conn <peconn@chromium.org>
Reviewed-by: default avatarPeter Beverloo <peter@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710304}
parent 10de5546
......@@ -17,14 +17,8 @@ import android.graphics.Bitmap;
import android.net.Uri;
import android.os.RemoteException;
import androidx.annotation.Nullable;
import androidx.browser.trusted.TrustedWebActivityService;
import androidx.browser.trusted.TrustedWebActivityServiceConnectionManager;
import androidx.browser.trusted.TrustedWebActivityServiceWrapper;
import org.chromium.base.ContextUtils;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.browserservices.TrustedWebActivityUmaRecorder.DelegatedNotificationSmallIconFallback;
import org.chromium.chrome.browser.browserservices.permissiondelegation.NotificationPermissionUpdater;
import org.chromium.chrome.browser.notifications.NotificationBuilderBase;
......@@ -38,6 +32,11 @@ import java.util.Set;
import javax.inject.Inject;
import javax.inject.Singleton;
import androidx.annotation.Nullable;
import androidx.browser.trusted.TrustedWebActivityService;
import androidx.browser.trusted.TrustedWebActivityServiceConnectionManager;
import androidx.browser.trusted.TrustedWebActivityServiceWrapper;
/**
* Uses a Trusted Web Activity client to display notifications.
*/
......@@ -190,8 +189,6 @@ public class TrustedWebActivityClient {
*/
public static @Nullable Intent createLaunchIntentForTwa(Context appContext, String url,
List<ResolveInfo> resolveInfosForUrl) {
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.TRUSTED_WEB_ACTIVITY)) return null;
Origin origin = new Origin(url);
// Trusted Web Activities only work with https so we can shortcut here.
......
......@@ -11,13 +11,10 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import androidx.annotation.WorkerThread;
import org.chromium.base.Log;
import org.chromium.base.PackageManagerUtils;
import org.chromium.base.task.PostTask;
import org.chromium.chrome.browser.ChromeApplication;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.browserservices.BrowserServicesMetrics;
import org.chromium.chrome.browser.browserservices.Origin;
import org.chromium.chrome.browser.browserservices.TrustedWebActivityClient;
......@@ -27,6 +24,8 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import androidx.annotation.WorkerThread;
/**
* This class updates the notification permission for an Origin based on the notification permission
* that the linked TWA has in Android. It also reverts the notification permission back to that the
......@@ -60,11 +59,6 @@ public class NotificationPermissionUpdater {
* - Otherwise, it does nothing.
*/
public void onOriginVerified(Origin origin, String packageName) {
if (!ChromeFeatureList.isEnabled(
ChromeFeatureList.TRUSTED_WEB_ACTIVITY_NOTIFICATION_DELEGATION_ENROLMENT)) {
return;
}
// If the client doesn't handle browsable Intents for the URL, we don't do anything special
// for the origin's notifications.
if (!appHandlesBrowsableIntent(packageName, origin.uri())) {
......@@ -88,11 +82,6 @@ public class NotificationPermissionUpdater {
* app was installed.
*/
public void onClientAppUninstalled(Origin origin) {
if (ChromeFeatureList.isInitialized() && !ChromeFeatureList.isEnabled(
ChromeFeatureList.TRUSTED_WEB_ACTIVITY_NOTIFICATION_DELEGATION_ENROLMENT)) {
return;
}
// See if there is any other app installed that could handle the notifications (and update
// to that apps notification permission if it exists).
boolean couldConnect = mTrustedWebActivityClient.checkNotificationPermission(origin,
......
......@@ -7,7 +7,6 @@ package org.chromium.chrome.browser.browserservices.trustedwebactivityui.control
import org.chromium.base.Callback;
import org.chromium.base.ObserverList;
import org.chromium.base.Promise;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.browserservices.BrowserServicesIntentDataProvider;
import org.chromium.chrome.browser.browserservices.Origin;
import org.chromium.chrome.browser.browserservices.trustedwebactivityui.TrustedWebActivityModel;
......@@ -81,10 +80,6 @@ public class Verifier implements NativeInitObserver {
@Override
public void onDidFinishNavigation(Tab tab, NavigationHandle navigation) {
if (!navigation.hasCommitted() || !navigation.isInMainFrame()) return;
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.TRUSTED_WEB_ACTIVITY)) {
assert false : "Shouldn't observe navigation when TWAs are disabled";
return;
}
verifyVisitedOrigin(new Origin(navigation.getUrl()));
}
};
......@@ -150,11 +145,6 @@ public class Verifier implements NativeInitObserver {
@Override
public void onFinishNativeInitialization() {
Origin initialOrigin = new Origin(mIntentDataProvider.getUrlToLoad());
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.TRUSTED_WEB_ACTIVITY)) {
mTabObserverRegistrar.unregisterTabObserver(mVerifyOnPageLoadObserver);
updateState(initialOrigin, VerificationStatus.FAILURE);
return;
}
collectTrustedOrigins(initialOrigin);
verifyVisitedOrigin(initialOrigin);
......
......@@ -184,9 +184,7 @@ const base::Feature* kFeaturesExposedToJava[] = {
&kTabSwitcherLongpressMenu,
&kTabSwitcherOnReturn,
&kTabToGTSAnimation,
&kTrustedWebActivity,
&kTrustedWebActivityPostMessage,
&kTrustedWebActivityNotificationDelegationEnrolment,
&kStartSurfaceAndroid,
&kUmaBackgroundSessions,
&kUpdateNotificationSchedulingIntegration,
......@@ -561,16 +559,9 @@ const base::Feature kTabSwitcherOnReturn{"TabSwitcherOnReturn",
const base::Feature kTabToGTSAnimation{"TabToGTSAnimation",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kTrustedWebActivity{"TrustedWebActivity",
base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kTrustedWebActivityPostMessage{
"TrustedWebActivityPostMessage", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kTrustedWebActivityNotificationDelegationEnrolment{
"TrustedWebActivityNotificationDelegationAutoEnrolment",
base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kStartSurfaceAndroid{"StartSurfaceAndroid",
base::FEATURE_DISABLED_BY_DEFAULT};
......
......@@ -115,9 +115,7 @@ extern const base::Feature kTabReparenting;
extern const base::Feature kTabSwitcherLongpressMenu;
extern const base::Feature kTabSwitcherOnReturn;
extern const base::Feature kTabToGTSAnimation;
extern const base::Feature kTrustedWebActivity;
extern const base::Feature kTrustedWebActivityPostMessage;
extern const base::Feature kTrustedWebActivityNotificationDelegationEnrolment;
extern const base::Feature kStartSurfaceAndroid;
extern const base::Feature kUmaBackgroundSessions;
extern const base::Feature kUpdateNotificationSchedulingIntegration;
......
......@@ -120,13 +120,10 @@ scoped_refptr<RefcountedKeyedService>
HostContentSettingsMap::NOTIFICATION_ANDROID_PROVIDER,
std::move(channels_provider));
if (base::FeatureList::IsEnabled(chrome::android::
kTrustedWebActivityNotificationDelegationEnrolment)) {
auto webapp_provider = std::make_unique<InstalledWebappProvider>();
settings_map->RegisterProvider(
HostContentSettingsMap::INSTALLED_WEBAPP_PROVIDER,
std::move(webapp_provider));
}
auto webapp_provider = std::make_unique<InstalledWebappProvider>();
settings_map->RegisterProvider(
HostContentSettingsMap::INSTALLED_WEBAPP_PROVIDER,
std::move(webapp_provider));
}
#endif // defined (OS_ANDROID)
return settings_map;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment