Commit 842ece22 authored by cco3's avatar cco3 Committed by Commit bot

Read feature param for Physical Web experiment

BUG=529962

Review URL: https://codereview.chromium.org/1512113002

Cr-Commit-Position: refs/heads/master@{#367025}
parent 10682844
......@@ -203,12 +203,6 @@ public abstract class ChromeSwitches {
*/
public static final String ENABLE_HUNG_RENDERER_INFOBAR = "enable-hung-renderer-infobar";
/**
* Enable Physical Web feature.
* Native switch - switches::kEnablePhysicalWeb
*/
public static final String ENABLE_PHYSICAL_WEB = "enable-physical-web";
/**
* Enables Web Notification custom layouts.
* Native switch - switches::kEnableWebNotificationCustomLayouts
......
......@@ -9,10 +9,8 @@ import android.content.SharedPreferences;
import android.os.AsyncTask;
import android.preference.PreferenceManager;
import org.chromium.base.CommandLine;
import org.chromium.chrome.browser.ChromeApplication;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.ChromeVersionInfo;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager;
/**
......@@ -21,6 +19,7 @@ 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 FEATURE_NAME = "PhysicalWeb";
/**
* Evaluate whether the environment is one in which the Physical Web should
......@@ -28,11 +27,7 @@ public class PhysicalWeb {
* @return true if the PhysicalWeb should be enabled
*/
public static boolean featureIsEnabled() {
boolean allowedChannel =
ChromeVersionInfo.isLocalBuild() || ChromeVersionInfo.isDevBuild();
boolean switchEnabled =
CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_PHYSICAL_WEB);
return allowedChannel && switchEnabled;
return ChromeFeatureList.isEnabled(FEATURE_NAME);
}
/**
......
......@@ -67,7 +67,9 @@
#include "ui/native_theme/native_theme_switches.h"
#include "ui/views/views_switches.h"
#if !defined(OS_ANDROID)
#if defined(OS_ANDROID)
#include "chrome/browser/android/chrome_feature_list.h"
#else
#include "ui/message_center/message_center_switches.h"
#endif
......@@ -1328,7 +1330,7 @@ const FeatureEntry kFeatureEntries[] = {
IDS_FLAGS_ENABLE_PHYSICAL_WEB_NAME,
IDS_FLAGS_ENABLE_PHYSICAL_WEB_DESCRIPTION,
kOsAndroid,
SINGLE_VALUE_TYPE(switches::kEnablePhysicalWeb)},
FEATURE_VALUE_TYPE(chrome::android::kPhysicalWebFeature)},
#endif
{"enable-zero-copy",
IDS_FLAGS_ZERO_COPY_NAME,
......
......@@ -20,10 +20,6 @@ namespace android {
namespace {
const base::Feature kPhysicalWebFeature {
"PhysicalWeb", base::FEATURE_DISABLED_BY_DEFAULT
};
// Array of features exposed through the Java ChromeFeatureList API. Entries in
// this array may either refer to features defined in this file (above) or in
// other locations in the code base (e.g. chrome/, components/, etc).
......@@ -33,6 +29,10 @@ const base::Feature* kFeaturesExposedToJava[] = {
} // namespace
const base::Feature kPhysicalWebFeature {
"PhysicalWeb", base::FEATURE_DISABLED_BY_DEFAULT
};
static jboolean IsEnabled(JNIEnv* env,
const JavaParamRef<jclass>& clazz,
const JavaParamRef<jstring>& jfeature_name) {
......
......@@ -7,9 +7,13 @@
#include <jni.h>
#include "base/feature_list.h"
namespace chrome {
namespace android {
extern const base::Feature kPhysicalWebFeature;
bool RegisterChromeFeatureListJni(JNIEnv* env);
} // namespace android
......
......@@ -1139,9 +1139,6 @@ const char kEnableHostedMode[] = "enable-hosted-mode";
// unresponsive web content.
const char kEnableHungRendererInfoBar[] = "enable-hung-renderer-infobar";
// Enable Physical Web scanning.
const char kEnablePhysicalWeb[] = "enable-physical-web";
// Specifies Android phone page loading progress bar animation.
const char kProgressBarAnimation[] = "progress-bar-animation";
......
......@@ -310,7 +310,6 @@ extern const char kEnableContextualSearch[];
extern const char kEnableDomDistillerButtonAnimation[];
extern const char kEnableHostedMode[];
extern const char kEnableHungRendererInfoBar[];
extern const char kEnablePhysicalWeb[];
extern const char kProgressBarAnimation[];
extern const char kEnableThemeColorInTabbedMode[];
extern const char kDisableAutoHidingToolbarThreshold[];
......
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