| 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.annotation.SuppressLint; |
| 7 import android.app.Activity; | 8 import android.app.Activity; |
| 8 import android.app.Application; | 9 import android.app.Application; |
| 9 import android.content.SharedPreferences; | 10 import android.content.SharedPreferences; |
| 10 import android.provider.Settings; | 11 import android.provider.Settings; |
| 11 import android.support.annotation.Nullable; | 12 import android.support.annotation.Nullable; |
| 12 import android.text.TextUtils; | 13 import android.text.TextUtils; |
| 13 | 14 |
| 14 import org.chromium.base.ApplicationState; | 15 import org.chromium.base.ApplicationState; |
| 15 import org.chromium.base.ApplicationStatus; | 16 import org.chromium.base.ApplicationStatus; |
| 16 import org.chromium.base.ApplicationStatus.ApplicationStateListener; | 17 import org.chromium.base.ApplicationStatus.ApplicationStateListener; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 36 | 37 |
| 37 import java.lang.ref.WeakReference; | 38 import java.lang.ref.WeakReference; |
| 38 | 39 |
| 39 /** | 40 /** |
| 40 * Tracks the foreground session state for the Chrome activities. | 41 * Tracks the foreground session state for the Chrome activities. |
| 41 */ | 42 */ |
| 42 public class ChromeActivitySessionTracker { | 43 public class ChromeActivitySessionTracker { |
| 43 | 44 |
| 44 private static final String PREF_LOCALE = "locale"; | 45 private static final String PREF_LOCALE = "locale"; |
| 45 | 46 |
| 47 @SuppressLint("StaticFieldLeak") |
| 46 private static ChromeActivitySessionTracker sInstance; | 48 private static ChromeActivitySessionTracker sInstance; |
| 47 | 49 |
| 48 private final PowerBroadcastReceiver mPowerBroadcastReceiver = new PowerBroa
dcastReceiver(); | 50 private final PowerBroadcastReceiver mPowerBroadcastReceiver = new PowerBroa
dcastReceiver(); |
| 49 | 51 |
| 50 // Used to trigger variation changes (such as seed fetches) upon application
foregrounding. | 52 // Used to trigger variation changes (such as seed fetches) upon application
foregrounding. |
| 51 private VariationsSession mVariationsSession; | 53 private VariationsSession mVariationsSession; |
| 52 | 54 |
| 53 private Application mApplication; | 55 private Application mApplication; |
| 54 private boolean mIsInitialized; | 56 private boolean mIsInitialized; |
| 55 private boolean mIsStarted; | 57 private boolean mIsStarted; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 256 } |
| 255 | 257 |
| 256 /** | 258 /** |
| 257 * @return The PowerBroadcastReceiver for the browser process. | 259 * @return The PowerBroadcastReceiver for the browser process. |
| 258 */ | 260 */ |
| 259 @VisibleForTesting | 261 @VisibleForTesting |
| 260 public PowerBroadcastReceiver getPowerBroadcastReceiverForTesting() { | 262 public PowerBroadcastReceiver getPowerBroadcastReceiverForTesting() { |
| 261 return mPowerBroadcastReceiver; | 263 return mPowerBroadcastReceiver; |
| 262 } | 264 } |
| 263 } | 265 } |
| OLD | NEW |