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 @SuppressLint("StaticFieldLeak") |
132 private static InvalidationController sInstance; | 134 private static InvalidationController sInstance; |
133 | 135 |
134 private final Context mContext; | 136 private final Context mContext; |
135 | 137 |
136 /** | 138 /** |
137 * Whether session sync invalidations can be disabled. | 139 * Whether session sync invalidations can be disabled. |
138 */ | 140 */ |
139 private final boolean mCanDisableSessionInvalidations; | 141 private final boolean mCanDisableSessionInvalidations; |
140 | 142 |
141 /** | 143 /** |
(...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. | 355 // started if it did not stop itself when the application is paused. |
354 if (AndroidSyncSettings.isSyncEnabled(mContext)) { | 356 if (AndroidSyncSettings.isSyncEnabled(mContext)) { |
355 if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { | 357 if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { |
356 start(); | 358 start(); |
357 } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) { | 359 } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) { |
358 stop(); | 360 stop(); |
359 } | 361 } |
360 } | 362 } |
361 } | 363 } |
362 } | 364 } |
OLD | NEW |