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().getSignedInUser(), typesToRegister)
; | 197 ChromeSigninController.get(mContext).getSignedInUser(), |
| 198 typesToRegister); |
198 registerIntent.setClass( | 199 registerIntent.setClass( |
199 mContext, InvalidationClientService.getRegisteredClass()); | 200 mContext, InvalidationClientService.getRegisteredClass()); |
200 startServiceIfPossible(registerIntent); | 201 startServiceIfPossible(registerIntent); |
201 } | 202 } |
202 | 203 |
203 /** | 204 /** |
204 * Registers for Google Cloud Messaging (GCM) for Invalidations. | 205 * Registers for Google Cloud Messaging (GCM) for Invalidations. |
205 */ | 206 */ |
206 private void ensureGcmIsInitialized() { | 207 private void ensureGcmIsInitialized() { |
207 if (mGcmInitialized) return; | 208 if (mGcmInitialized) return; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // started if it did not stop itself when the application is paused. | 363 // started if it did not stop itself when the application is paused. |
363 if (AndroidSyncSettings.isSyncEnabled(mContext)) { | 364 if (AndroidSyncSettings.isSyncEnabled(mContext)) { |
364 if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { | 365 if (newState == ApplicationState.HAS_RUNNING_ACTIVITIES) { |
365 start(); | 366 start(); |
366 } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) { | 367 } else if (newState == ApplicationState.HAS_PAUSED_ACTIVITIES) { |
367 stop(); | 368 stop(); |
368 } | 369 } |
369 } | 370 } |
370 } | 371 } |
371 } | 372 } |
OLD | NEW |