Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2753)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java

Issue 2071713002: Add a PhysicalWebIgnoreOtherClients feature (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Store setting in onChromeStart Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
index 63b25af5af7f11f0b7109d85a1040b695166f459..d089d1e6016f637dd1ffded8e64e765f5e886ba7 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/physicalweb/PhysicalWeb.java
@@ -20,7 +20,9 @@ import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager
public class PhysicalWeb {
public static final int OPTIN_NOTIFY_MAX_TRIES = 1;
private static final String PREF_PHYSICAL_WEB_NOTIFY_COUNT = "physical_web_notify_count";
+ private static final String PREF_IGNORE_OTHER_CLIENTS = "physical_web_ignore_other_clients";
private static final String FEATURE_NAME = "PhysicalWeb";
+ private static final String IGNORE_OTHER_CLIENTS_FEATURE_NAME = "PhysicalWebIgnoreOtherClients";
private static final int MIN_ANDROID_VERSION = 18;
/**
@@ -78,6 +80,15 @@ public class PhysicalWeb {
}
/**
+ * Returns true if we should fire notifications regardless of the existence of other Physical
+ * Web clients.
+ * This method is for use when the native library is not available.
+ */
+ public static boolean shouldIgnoreOtherClients() {
+ return ContextUtils.getAppSharedPreferences().getBoolean(PREF_IGNORE_OTHER_CLIENTS, false);
+ }
+
+ /**
* Increments a value tracking how many times we've shown the Physical Web
* opt-in notification.
*
@@ -112,6 +123,11 @@ public class PhysicalWeb {
// loaded. This is always the case on chrome startup.
if (featureIsEnabled()
&& (isPhysicalWebPreferenceEnabled(application) || isOnboarding(application))) {
+ boolean ignoreOtherClients =
+ ChromeFeatureList.isEnabled(IGNORE_OTHER_CLIENTS_FEATURE_NAME);
+ ContextUtils.getAppSharedPreferences().edit()
+ .putBoolean(PREF_IGNORE_OTHER_CLIENTS, ignoreOtherClients)
+ .apply();
startPhysicalWeb(application);
PhysicalWebUma.uploadDeferredMetrics(application);
} else {
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/physicalweb/UrlManager.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698