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

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

Issue 2828093002: Add plumbing for accessing latest country in variations service in Java (Closed)
Patch Set: nits Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/metrics/VariationsSession.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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; 5 package org.chromium.chrome.browser;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.app.Application; 8 import android.app.Application;
9 import android.content.SharedPreferences; 9 import android.content.SharedPreferences;
10 import android.provider.Settings; 10 import android.provider.Settings;
11 import android.support.annotation.Nullable;
11 import android.text.TextUtils; 12 import android.text.TextUtils;
12 13
13 import org.chromium.base.ApplicationState; 14 import org.chromium.base.ApplicationState;
14 import org.chromium.base.ApplicationStatus; 15 import org.chromium.base.ApplicationStatus;
15 import org.chromium.base.ApplicationStatus.ApplicationStateListener; 16 import org.chromium.base.ApplicationStatus.ApplicationStateListener;
16 import org.chromium.base.Callback; 17 import org.chromium.base.Callback;
17 import org.chromium.base.ContextUtils; 18 import org.chromium.base.ContextUtils;
18 import org.chromium.base.LocaleUtils; 19 import org.chromium.base.LocaleUtils;
19 import org.chromium.base.ThreadUtils; 20 import org.chromium.base.ThreadUtils;
20 import org.chromium.base.VisibleForTesting; 21 import org.chromium.base.VisibleForTesting;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 /** 77 /**
77 * Asynchronously returns the value of the "restrict" URL param that the var iations service 78 * Asynchronously returns the value of the "restrict" URL param that the var iations service
78 * should use for variation seed requests. 79 * should use for variation seed requests.
79 * @param callback Callback that will be called with the param value when av ailable. 80 * @param callback Callback that will be called with the param value when av ailable.
80 */ 81 */
81 public void getVariationsRestrictModeValue(Callback<String> callback) { 82 public void getVariationsRestrictModeValue(Callback<String> callback) {
82 mVariationsSession.getRestrictModeValue(mApplication, callback); 83 mVariationsSession.getRestrictModeValue(mApplication, callback);
83 } 84 }
84 85
85 /** 86 /**
87 * @return The latest country according to the current variations state. Nul l if not available.
88 */
89 @Nullable
90 public String getVariationsLatestCountry() {
91 return mVariationsSession.getLatestCountry();
92 }
93
94 /**
86 * Handle any initialization that occurs once native has been loaded. 95 * Handle any initialization that occurs once native has been loaded.
87 */ 96 */
88 public void initializeWithNative() { 97 public void initializeWithNative() {
89 ThreadUtils.assertOnUiThread(); 98 ThreadUtils.assertOnUiThread();
90 99
91 if (mIsInitialized) return; 100 if (mIsInitialized) return;
92 mIsInitialized = true; 101 mIsInitialized = true;
93 assert !mIsStarted; 102 assert !mIsStarted;
94 103
95 ApplicationStatus.registerApplicationStateListener(createApplicationStat eListener()); 104 ApplicationStatus.registerApplicationStateListener(createApplicationStat eListener());
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 254 }
246 255
247 /** 256 /**
248 * @return The PowerBroadcastReceiver for the browser process. 257 * @return The PowerBroadcastReceiver for the browser process.
249 */ 258 */
250 @VisibleForTesting 259 @VisibleForTesting
251 public PowerBroadcastReceiver getPowerBroadcastReceiverForTesting() { 260 public PowerBroadcastReceiver getPowerBroadcastReceiverForTesting() {
252 return mPowerBroadcastReceiver; 261 return mPowerBroadcastReceiver;
253 } 262 }
254 } 263 }
OLDNEW
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/metrics/VariationsSession.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698