Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.sync; | 5 package org.chromium.chrome.browser.sync; |
| 6 | 6 |
| 7 import android.accounts.Account; | 7 import android.accounts.Account; |
| 8 import android.app.Activity; | 8 import android.app.Activity; |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.util.Log; | 10 import android.util.Log; |
| 11 | 11 |
| 12 import org.chromium.base.ThreadUtils; | 12 import org.chromium.base.ThreadUtils; |
| 13 import org.chromium.chrome.browser.identity.UniqueIdentificationGeneratorFactory ; | |
| 13 import org.chromium.chrome.browser.invalidation.InvalidationController; | 14 import org.chromium.chrome.browser.invalidation.InvalidationController; |
| 14 import org.chromium.chrome.browser.signin.SigninManager; | 15 import org.chromium.chrome.browser.signin.SigninManager; |
| 15 import org.chromium.chrome.browser.signin.SigninManager.SignInFlowObserver; | 16 import org.chromium.chrome.browser.signin.SigninManager.SignInFlowObserver; |
| 16 import org.chromium.sync.AndroidSyncSettings; | 17 import org.chromium.sync.AndroidSyncSettings; |
| 17 import org.chromium.sync.signin.AccountManagerHelper; | 18 import org.chromium.sync.signin.AccountManagerHelper; |
| 18 import org.chromium.sync.signin.ChromeSigninController; | 19 import org.chromium.sync.signin.ChromeSigninController; |
| 19 | 20 |
| 20 /** | 21 /** |
| 21 * SyncController handles the coordination of sync state between the invalidatio n controller, | 22 * SyncController handles the coordination of sync state between the invalidatio n controller, |
| 22 * the Android sync settings, and the native sync code. | 23 * the Android sync settings, and the native sync code. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 53 private SyncNotificationController mSyncNotificationController = null; | 54 private SyncNotificationController mSyncNotificationController = null; |
| 54 | 55 |
| 55 private SyncController(Context context) { | 56 private SyncController(Context context) { |
| 56 mContext = context; | 57 mContext = context; |
| 57 mChromeSigninController = ChromeSigninController.get(mContext); | 58 mChromeSigninController = ChromeSigninController.get(mContext); |
| 58 mAndroidSyncSettings = AndroidSyncSettings.get(context); | 59 mAndroidSyncSettings = AndroidSyncSettings.get(context); |
| 59 mAndroidSyncSettings.registerObserver(this); | 60 mAndroidSyncSettings.registerObserver(this); |
| 60 mProfileSyncService = ProfileSyncService.get(mContext); | 61 mProfileSyncService = ProfileSyncService.get(mContext); |
| 61 mProfileSyncService.addSyncStateChangedListener(this); | 62 mProfileSyncService.addSyncStateChangedListener(this); |
| 62 mChromeSigninController.ensureGcmIsInitialized(); | 63 mChromeSigninController.ensureGcmIsInitialized(); |
| 64 // Since we do not override the UniqueIdentificationGenerator, we get it from the factory, | |
|
nyquist
2015/03/04 09:15:13
Do not use pronouns in comments.
maxbogue
2015/03/04 18:40:48
Hmm, that comment didn't really make sense anymore
| |
| 65 // instead of using the instance we just created. | |
| 66 mProfileSyncService.setSessionsId( | |
| 67 UniqueIdentificationGeneratorFactory.getInstance(GENERATOR_ID)); | |
| 63 } | 68 } |
| 64 | 69 |
| 65 /** | 70 /** |
| 66 * Retrieve the singleton instance of this class. | 71 * Retrieve the singleton instance of this class. |
| 67 * | 72 * |
| 68 * @param context the current context. | 73 * @param context the current context. |
| 69 * @return the singleton instance. | 74 * @return the singleton instance. |
| 70 */ | 75 */ |
| 71 public static SyncController get(Context context) { | 76 public static SyncController get(Context context) { |
| 72 ThreadUtils.assertOnUiThread(); | 77 ThreadUtils.assertOnUiThread(); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 mProfileSyncService.addSyncStateChangedListener(mSyncNotificationControl ler); | 209 mProfileSyncService.addSyncStateChangedListener(mSyncNotificationControl ler); |
| 205 } | 210 } |
| 206 | 211 |
| 207 /** | 212 /** |
| 208 * Returns the SyncNotificationController. | 213 * Returns the SyncNotificationController. |
| 209 */ | 214 */ |
| 210 public SyncNotificationController getSyncNotificationController() { | 215 public SyncNotificationController getSyncNotificationController() { |
| 211 return mSyncNotificationController; | 216 return mSyncNotificationController; |
| 212 } | 217 } |
| 213 } | 218 } |
| OLD | NEW |