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; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 HashSet<Integer> typesToRegister = new HashSet<Integer>(); | 188 HashSet<Integer> typesToRegister = new HashSet<Integer>(); |
189 typesToRegister.addAll(syncService.getPreferredDataTypes()); | 189 typesToRegister.addAll(syncService.getPreferredDataTypes()); |
190 if (!mSessionInvalidationsEnabled) { | 190 if (!mSessionInvalidationsEnabled) { |
191 typesToRegister.remove(ModelType.SESSIONS); | 191 typesToRegister.remove(ModelType.SESSIONS); |
192 typesToRegister.remove(ModelType.FAVICON_TRACKING); | 192 typesToRegister.remove(ModelType.FAVICON_TRACKING); |
193 typesToRegister.remove(ModelType.FAVICON_IMAGES); | 193 typesToRegister.remove(ModelType.FAVICON_IMAGES); |
194 } | 194 } |
195 | 195 |
196 Intent registerIntent = InvalidationIntentProtocol.createRegisterIntent( | 196 Intent registerIntent = InvalidationIntentProtocol.createRegisterIntent( |
197 ChromeSigninController.get(mContext).getSignedInUser(), | 197 ChromeSigninController.get().getSignedInUser(), typesToRegister)
; |
198 typesToRegister); | |
199 registerIntent.setClass( | 198 registerIntent.setClass( |
200 mContext, InvalidationClientService.getRegisteredClass()); | 199 mContext, InvalidationClientService.getRegisteredClass()); |
201 startServiceIfPossible(registerIntent); | 200 startServiceIfPossible(registerIntent); |
202 } | 201 } |
203 | 202 |
204 /** | 203 /** |
205 * Registers for Google Cloud Messaging (GCM) for Invalidations. | 204 * Registers for Google Cloud Messaging (GCM) for Invalidations. |
206 */ | 205 */ |
207 private void ensureGcmIsInitialized() { | 206 private void ensureGcmIsInitialized() { |
208 if (mGcmInitialized) return; | 207 if (mGcmInitialized) return; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 // started if it did not stop itself when the application is paused. | 362 // started if it did not stop itself when the application is paused. |
364 if (AndroidSyncSettings.isSyncEnabled(mContext)) { | 363 if (AndroidSyncSettings.isSyncEnabled(mContext)) { |
365 if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { | 364 if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { |
366 start(); | 365 start(); |
367 } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) { | 366 } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) { |
368 stop(); | 367 stop(); |
369 } | 368 } |
370 } | 369 } |
371 } | 370 } |
372 } | 371 } |
OLD | NEW |