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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/metrics/VariationsSession.java

Issue 1566523002: [Signin] Prepare to remove use of deprecated AMH method in VariationsSerssion. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.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/metrics/VariationsSession.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/metrics/VariationsSession.java b/chrome/android/java/src/org/chromium/chrome/browser/metrics/VariationsSession.java
index c6f763cf78d8c694e684464696a5304e8cfc9243..5775e7a2f73e4f71f7c795fcc134fff3bc04a852 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/metrics/VariationsSession.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/VariationsSession.java
@@ -6,6 +6,8 @@ package org.chromium.chrome.browser.metrics;
import android.content.Context;
+import org.chromium.base.Callback;
+
/**
* Sets up communication with the VariationsService. This is primarily used for
* triggering seed fetches on application startup.
@@ -22,15 +24,30 @@ public class VariationsSession {
mInitialized = true;
// Check the restrict mode only once initially to avoid doing extra work each time the
// app enters foreground.
- mRestrictMode = getRestrictMode(context);
+ getRestrictMode(context, new Callback<String>() {
+ @Override
+ public void onResult(String restrictMode) {
+ assert restrictMode != null;
+ mRestrictMode = restrictMode;
+ nativeStartVariationsSession(mRestrictMode);
+ }
+ });
+ // If |mRestrictMode| is null, async initialization is in progress and
+ // nativeStartVariationsSession will be called when it completes.
+ } else if (mRestrictMode != null) {
+ nativeStartVariationsSession(mRestrictMode);
}
- nativeStartVariationsSession(mRestrictMode);
}
/**
- * Returns the value of the "restrict" URL param that the variations service should use for
- * variation seed requests.
+ * Asynchronously returns the value of the "restrict" URL param that the variations service
+ * should use for variation seed requests.
*/
+ protected void getRestrictMode(Context context, Callback<String> callback) {
+ callback.onResult(getRestrictMode(context));
+ }
+
+ // TODO(maxbogue): Remove once downstream is updated to be async.
protected String getRestrictMode(Context context) {
return "";
}
« no previous file with comments | « no previous file | sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698