| 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.content.Context; | 7 import android.content.Context; |
| 8 import android.content.Intent; | 8 import android.content.Intent; |
| 9 import android.os.AsyncTask; | 9 import android.os.AsyncTask; |
| 10 import android.os.Handler; | 10 import android.os.Handler; |
| 11 import android.os.SystemClock; | 11 import android.os.SystemClock; |
| 12 | 12 |
| 13 import com.google.ipc.invalidation.ticl.android2.channel.AndroidGcmController; | 13 import com.google.ipc.invalidation.ticl.android2.channel.AndroidGcmController; |
| 14 | 14 |
| 15 import org.chromium.base.ApplicationState; | 15 import org.chromium.base.ApplicationState; |
| 16 import org.chromium.base.ApplicationStatus; | 16 import org.chromium.base.ApplicationStatus; |
| 17 import org.chromium.base.FieldTrialList; | 17 import org.chromium.base.FieldTrialList; |
| 18 import org.chromium.base.VisibleForTesting; | 18 import org.chromium.base.VisibleForTesting; |
| 19 import org.chromium.chrome.browser.sync.ProfileSyncService; | 19 import org.chromium.chrome.browser.sync.ProfileSyncService; |
| 20 import org.chromium.components.invalidation.InvalidationClientService; | 20 import org.chromium.components.invalidation.InvalidationClientService; |
| 21 import org.chromium.sync.AndroidSyncSettings; | 21 import org.chromium.components.sync.AndroidSyncSettings; |
| 22 import org.chromium.sync.ModelType; | 22 import org.chromium.components.sync.ModelType; |
| 23 import org.chromium.sync.notifier.InvalidationIntentProtocol; | 23 import org.chromium.components.sync.notifier.InvalidationIntentProtocol; |
| 24 import org.chromium.sync.signin.ChromeSigninController; | 24 import org.chromium.components.sync.signin.ChromeSigninController; |
| 25 | 25 |
| 26 import java.util.HashSet; | 26 import java.util.HashSet; |
| 27 | 27 |
| 28 /** | 28 /** |
| 29 * Controller used to send start, stop, and registration-change commands to the
invalidation | 29 * Controller used to send start, stop, and registration-change commands to the
invalidation |
| 30 * client library used by Sync. | 30 * client library used by Sync. |
| 31 */ | 31 */ |
| 32 public class InvalidationController implements ApplicationStatus.ApplicationStat
eListener { | 32 public class InvalidationController implements ApplicationStatus.ApplicationStat
eListener { |
| 33 /** | 33 /** |
| 34 * Timer which can be paused. When the timer is paused, the execution of its
scheduled task is | 34 * Timer which can be paused. When the timer is paused, the execution of its
scheduled task is |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 // started if it did not stop itself when the application is paused. | 336 // started if it did not stop itself when the application is paused. |
| 337 if (AndroidSyncSettings.isSyncEnabled(mContext)) { | 337 if (AndroidSyncSettings.isSyncEnabled(mContext)) { |
| 338 if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { | 338 if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { |
| 339 start(); | 339 start(); |
| 340 } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) { | 340 } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) { |
| 341 stop(); | 341 stop(); |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 } | 344 } |
| 345 } | 345 } |
| OLD | NEW |