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 // TODO(crbug.com/635567): Fix this properly. | |
Ted C
2017/04/27 19:02:47
Again, this is a leaky singleton intentionally
So
F
2017/04/28 18:25:14
Done.
| |
48 @SuppressLint("StaticFieldLeak") | |
46 private static ChromeActivitySessionTracker sInstance; | 49 private static ChromeActivitySessionTracker sInstance; |
47 | 50 |
48 private final PowerBroadcastReceiver mPowerBroadcastReceiver = new PowerBroa dcastReceiver(); | 51 private final PowerBroadcastReceiver mPowerBroadcastReceiver = new PowerBroa dcastReceiver(); |
49 | 52 |
50 // Used to trigger variation changes (such as seed fetches) upon application foregrounding. | 53 // Used to trigger variation changes (such as seed fetches) upon application foregrounding. |
51 private VariationsSession mVariationsSession; | 54 private VariationsSession mVariationsSession; |
52 | 55 |
53 private Application mApplication; | 56 private Application mApplication; |
54 private boolean mIsInitialized; | 57 private boolean mIsInitialized; |
55 private boolean mIsStarted; | 58 private boolean mIsStarted; |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 } | 257 } |
255 | 258 |
256 /** | 259 /** |
257 * @return The PowerBroadcastReceiver for the browser process. | 260 * @return The PowerBroadcastReceiver for the browser process. |
258 */ | 261 */ |
259 @VisibleForTesting | 262 @VisibleForTesting |
260 public PowerBroadcastReceiver getPowerBroadcastReceiverForTesting() { | 263 public PowerBroadcastReceiver getPowerBroadcastReceiverForTesting() { |
261 return mPowerBroadcastReceiver; | 264 return mPowerBroadcastReceiver; |
262 } | 265 } |
263 } | 266 } |
OLD | NEW |