Chromium Code Reviews| 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 0ae107c5951519fa916c3040c093cdb50a91cfb2..67a74ed6a4ff96d361bbf7a21ce1c7de33f338b2 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 |
| @@ -55,17 +55,6 @@ public class PhysicalWeb { |
| } |
| /** |
| - * Evaluate whether the Physical Web should be enabled when the application starts. |
| - * |
| - * @param context An instance of android.content.Context |
| - * @return true if the Physical Web should be started at launch |
| - */ |
| - public static boolean shouldStartOnLaunch(Context context) { |
| - return featureIsEnabled() |
| - && (isPhysicalWebPreferenceEnabled(context) || isOnboarding(context)); |
| - } |
| - |
| - /** |
| * Start the Physical Web feature. |
| * At the moment, this only enables URL discovery over BLE. |
| * @param application An instance of {@link ChromeApplication}, used to get the |
| @@ -89,15 +78,6 @@ public class PhysicalWeb { |
| } |
| /** |
| - * Upload the collected UMA stats. |
| - * This method should be called only when the native library is loaded. |
| - * @param context A valid instance of Context. |
| - */ |
| - public static void uploadDeferredMetrics(final Context context) { |
| - PhysicalWebUma.uploadDeferredMetrics(context); |
| - } |
| - |
| - /** |
| * Increments a value tracking how many times we've shown the Physical Web |
| * opt-in notification. |
| * |
| @@ -123,6 +103,22 @@ public class PhysicalWeb { |
| return sharedPreferences.getInt(PREF_PHYSICAL_WEB_NOTIFY_COUNT, 0); |
| } |
| + /** |
| + * Perform various Physical Web operations that should happen on startup. |
| + * @param application An instance of {@link ChromeApplication}. |
| + */ |
| + public static void onChromeStart(ChromeApplication application) { |
|
Yaron
2016/04/14 01:35:55
I'd love to see this dependency on ChromeApplicati
cco3
2016/04/15 22:10:27
Some of these calls rely on ChromeApplication.crea
|
| + // The PhysicalWebUma calls in this method should be called only when the native library is |
| + // loaded. This is always the case on chrome startup. |
| + if (featureIsEnabled() |
| + && (isPhysicalWebPreferenceEnabled(application) || isOnboarding(application))) { |
| + startPhysicalWeb(application); |
| + PhysicalWebUma.uploadDeferredMetrics(application); |
| + } else { |
| + stopPhysicalWeb(application); |
| + } |
| + } |
| + |
| private static void clearUrlsAsync(final Context context) { |
| Runnable task = new Runnable() { |
| @Override |