OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.invalidation; | 5 package org.chromium.chrome.browser.invalidation; |
6 | 6 |
| 7 import android.annotation.SuppressLint; |
7 import android.content.Context; | 8 import android.content.Context; |
8 import android.content.Intent; | 9 import android.content.Intent; |
9 import android.os.AsyncTask; | 10 import android.os.AsyncTask; |
10 import android.os.Handler; | 11 import android.os.Handler; |
11 import android.os.SystemClock; | 12 import android.os.SystemClock; |
12 | 13 |
13 import com.google.ipc.invalidation.ticl.android2.channel.AndroidGcmController; | 14 import com.google.ipc.invalidation.ticl.android2.channel.AndroidGcmController; |
14 | 15 |
15 import org.chromium.base.ApplicationState; | 16 import org.chromium.base.ApplicationState; |
16 import org.chromium.base.ApplicationStatus; | 17 import org.chromium.base.ApplicationStatus; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 123 |
123 /** | 124 /** |
124 * The amount of time after the RecentTabsPage is closed to unregister for s
ession sync | 125 * The amount of time after the RecentTabsPage is closed to unregister for s
ession sync |
125 * invalidations. The delay is long to avoid registering and unregistering a
lot if the user | 126 * invalidations. The delay is long to avoid registering and unregistering a
lot if the user |
126 * visits the RecentTabsPage a lot. | 127 * visits the RecentTabsPage a lot. |
127 */ | 128 */ |
128 private static final int UNREGISTER_FOR_SESSION_SYNC_INVALIDATIONS_DELAY_MS
= 3600000; // 1hr | 129 private static final int UNREGISTER_FOR_SESSION_SYNC_INVALIDATIONS_DELAY_MS
= 3600000; // 1hr |
129 | 130 |
130 private static final Object LOCK = new Object(); | 131 private static final Object LOCK = new Object(); |
131 | 132 |
| 133 // TODO(crbug.com/635567): Fix this properly. |
| 134 @SuppressLint("StaticFieldLeak") |
132 private static InvalidationController sInstance; | 135 private static InvalidationController sInstance; |
133 | 136 |
134 private final Context mContext; | 137 private final Context mContext; |
135 | 138 |
136 /** | 139 /** |
137 * Whether session sync invalidations can be disabled. | 140 * Whether session sync invalidations can be disabled. |
138 */ | 141 */ |
139 private final boolean mCanDisableSessionInvalidations; | 142 private final boolean mCanDisableSessionInvalidations; |
140 | 143 |
141 /** | 144 /** |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // started if it did not stop itself when the application is paused. | 356 // started if it did not stop itself when the application is paused. |
354 if (AndroidSyncSettings.isSyncEnabled(mContext)) { | 357 if (AndroidSyncSettings.isSyncEnabled(mContext)) { |
355 if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { | 358 if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { |
356 start(); | 359 start(); |
357 } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) { | 360 } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) { |
358 stop(); | 361 stop(); |
359 } | 362 } |
360 } | 363 } |
361 } | 364 } |
362 } | 365 } |
OLD | NEW |