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

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

Issue 1024993003: Upstream VariationsSession (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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/browser/android/chrome_jni_registrar.cc » ('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
new file mode 100644
index 0000000000000000000000000000000000000000..c6f763cf78d8c694e684464696a5304e8cfc9243
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/VariationsSession.java
@@ -0,0 +1,39 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.metrics;
+
+import android.content.Context;
+
+/**
+ * Sets up communication with the VariationsService. This is primarily used for
+ * triggering seed fetches on application startup.
+ */
+public class VariationsSession {
+ private boolean mInitialized;
+ private String mRestrictMode;
+
+ /**
+ * Triggers to the native VariationsService that the application has entered the foreground.
+ */
+ public void start(Context context) {
+ if (!mInitialized) {
+ mInitialized = true;
+ // Check the restrict mode only once initially to avoid doing extra work each time the
+ // app enters foreground.
+ mRestrictMode = getRestrictMode(context);
+ }
+ nativeStartVariationsSession(mRestrictMode);
+ }
+
+ /**
+ * Returns the value of the "restrict" URL param that the variations service should use for
+ * variation seed requests.
+ */
+ protected String getRestrictMode(Context context) {
+ return "";
+ }
+
+ private native void nativeStartVariationsSession(String restrictMode);
+}
« no previous file with comments | « no previous file | chrome/browser/android/chrome_jni_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698