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.content.SharedPreferences; | 10 import android.content.SharedPreferences; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 private boolean mFirstActivityStarted = false; | 75 private boolean mFirstActivityStarted = false; |
76 | 76 |
77 private SyncController(Context context) { | 77 private SyncController(Context context) { |
78 mContext = context; | 78 mContext = context; |
79 mChromeSigninController = ChromeSigninController.get(mContext); | 79 mChromeSigninController = ChromeSigninController.get(mContext); |
80 mAndroidSyncSettings = AndroidSyncSettings.get(context); | 80 mAndroidSyncSettings = AndroidSyncSettings.get(context); |
81 mAndroidSyncSettings.registerObserver(this); | 81 mAndroidSyncSettings.registerObserver(this); |
82 mProfileSyncService = ProfileSyncService.get(mContext); | 82 mProfileSyncService = ProfileSyncService.get(mContext); |
83 mProfileSyncService.addSyncStateChangedListener(this); | 83 mProfileSyncService.addSyncStateChangedListener(this); |
84 | 84 |
| 85 mChromeSigninController.ensureGcmIsInitialized(); |
| 86 |
85 // Set the sessions ID using the generator that was registered for GENER
ATOR_ID. | 87 // Set the sessions ID using the generator that was registered for GENER
ATOR_ID. |
86 mProfileSyncService.setSessionsId( | 88 mProfileSyncService.setSessionsId( |
87 UniqueIdentificationGeneratorFactory.getInstance(GENERATOR_ID)); | 89 UniqueIdentificationGeneratorFactory.getInstance(GENERATOR_ID)); |
88 | 90 |
89 // Create the SyncNotificationController. | 91 // Create the SyncNotificationController. |
90 mSyncNotificationController = new SyncNotificationController( | 92 mSyncNotificationController = new SyncNotificationController( |
91 mContext, PassphraseActivity.class, AccountManagementFragment.cl
ass); | 93 mContext, PassphraseActivity.class, AccountManagementFragment.cl
ass); |
92 mProfileSyncService.addSyncStateChangedListener(mSyncNotificationControl
ler); | 94 mProfileSyncService.addSyncStateChangedListener(mSyncNotificationControl
ler); |
93 | 95 |
94 updateSyncStateFromAndroid(); | 96 updateSyncStateFromAndroid(); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 mProfileSyncService.setSyncSetupCompleted(); | 257 mProfileSyncService.setSyncSetupCompleted(); |
256 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferen
ces(mContext); | 258 SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferen
ces(mContext); |
257 if (prefs.getBoolean(DELAY_SYNC_SETUP_PREF, false)) { | 259 if (prefs.getBoolean(DELAY_SYNC_SETUP_PREF, false)) { |
258 mProfileSyncService.setSetupInProgress(false); | 260 mProfileSyncService.setSetupInProgress(false); |
259 } | 261 } |
260 } | 262 } |
261 } | 263 } |
262 | 264 |
263 private void onFirstStart() { | 265 private void onFirstStart() { |
264 if (mAndroidSyncSettings.isSyncEnabled()) { | 266 if (mAndroidSyncSettings.isSyncEnabled()) { |
265 mChromeSigninController.ensureGcmIsInitialized(); | |
266 InvalidationController controller = InvalidationController.get(mCont
ext); | 267 InvalidationController controller = InvalidationController.get(mCont
ext); |
267 controller.refreshRegisteredTypes(mProfileSyncService.getPreferredDa
taTypes()); | 268 controller.refreshRegisteredTypes(mProfileSyncService.getPreferredDa
taTypes()); |
268 } | 269 } |
269 mFirstActivityStarted = true; | 270 mFirstActivityStarted = true; |
270 } | 271 } |
271 } | 272 } |
OLD | NEW |