| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |