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

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

Issue 1512113002: Read feature param for Physical Web experiment (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.physicalweb; 5 package org.chromium.chrome.browser.physicalweb;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.content.SharedPreferences; 8 import android.content.SharedPreferences;
9 import android.os.AsyncTask; 9 import android.os.AsyncTask;
10 import android.preference.PreferenceManager; 10 import android.preference.PreferenceManager;
11 11
12 import org.chromium.base.CommandLine;
13 import org.chromium.chrome.browser.ChromeApplication; 12 import org.chromium.chrome.browser.ChromeApplication;
14 import org.chromium.chrome.browser.ChromeSwitches; 13 import org.chromium.chrome.browser.ChromeFeatureList;
15 import org.chromium.chrome.browser.ChromeVersionInfo;
16 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager ; 14 import org.chromium.chrome.browser.preferences.privacy.PrivacyPreferencesManager ;
17 15
18 /** 16 /**
19 * This class provides the basic interface to the Physical Web feature. 17 * This class provides the basic interface to the Physical Web feature.
20 */ 18 */
21 public class PhysicalWeb { 19 public class PhysicalWeb {
22 public static final int OPTIN_NOTIFY_MAX_TRIES = 1; 20 public static final int OPTIN_NOTIFY_MAX_TRIES = 1;
23 private static final String PREF_PHYSICAL_WEB_NOTIFY_COUNT = "physical_web_n otify_count"; 21 private static final String PREF_PHYSICAL_WEB_NOTIFY_COUNT = "physical_web_n otify_count";
22 private static final String FEATURE_NAME = "PhysicalWeb";
24 23
25 /** 24 /**
26 * Evaluate whether the environment is one in which the Physical Web should 25 * Evaluate whether the environment is one in which the Physical Web should
27 * be enabled. 26 * be enabled.
28 * @return true if the PhysicalWeb should be enabled 27 * @return true if the PhysicalWeb should be enabled
29 */ 28 */
30 public static boolean featureIsEnabled() { 29 public static boolean featureIsEnabled() {
31 boolean allowedChannel = 30 return ChromeFeatureList.isEnabled(FEATURE_NAME);
32 ChromeVersionInfo.isLocalBuild() || ChromeVersionInfo.isDevBuild ();
33 boolean switchEnabled =
34 CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_PHYSIC AL_WEB);
35 return allowedChannel && switchEnabled;
36 } 31 }
37 32
38 /** 33 /**
39 * Checks whether the Physical Web preference is switched to On. 34 * Checks whether the Physical Web preference is switched to On.
40 * 35 *
41 * @param context An instance of android.content.Context 36 * @param context An instance of android.content.Context
42 * @return boolean {@code true} if the preference is On. 37 * @return boolean {@code true} if the preference is On.
43 */ 38 */
44 public static boolean isPhysicalWebPreferenceEnabled(Context context) { 39 public static boolean isPhysicalWebPreferenceEnabled(Context context) {
45 return PrivacyPreferencesManager.getInstance(context).isPhysicalWebEnabl ed(); 40 return PrivacyPreferencesManager.getInstance(context).isPhysicalWebEnabl ed();
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 private static void clearUrlsAsync(final Context context) { 123 private static void clearUrlsAsync(final Context context) {
129 Runnable task = new Runnable() { 124 Runnable task = new Runnable() {
130 @Override 125 @Override
131 public void run() { 126 public void run() {
132 UrlManager.getInstance(context).clearUrls(); 127 UrlManager.getInstance(context).clearUrls();
133 } 128 }
134 }; 129 };
135 AsyncTask.THREAD_POOL_EXECUTOR.execute(task); 130 AsyncTask.THREAD_POOL_EXECUTOR.execute(task);
136 } 131 }
137 } 132 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/ChromeSwitches.java ('k') | chrome/browser/about_flags.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698