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.app.Activity; | 7 import android.app.Activity; |
8 import android.content.Context; | 8 import android.content.Context; |
9 | 9 |
10 import org.chromium.base.ActivityState; | 10 import org.chromium.base.ActivityState; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 * An identifier for the generator in UniqueIdentificationGeneratorFactory t
o be used to | 55 * An identifier for the generator in UniqueIdentificationGeneratorFactory t
o be used to |
56 * generate the sync sessions ID. The generator is registered in the Applica
tion's onCreate | 56 * generate the sync sessions ID. The generator is registered in the Applica
tion's onCreate |
57 * method. | 57 * method. |
58 */ | 58 */ |
59 public static final String GENERATOR_ID = "SYNC"; | 59 public static final String GENERATOR_ID = "SYNC"; |
60 | 60 |
61 @VisibleForTesting | 61 @VisibleForTesting |
62 public static final String SESSION_TAG_PREFIX = "session_sync"; | 62 public static final String SESSION_TAG_PREFIX = "session_sync"; |
63 | 63 |
64 private static SyncController sInstance; | 64 private static SyncController sInstance; |
65 private static boolean sInitialized = false; | 65 private static boolean sInitialized; |
66 | 66 |
67 private final Context mContext; | 67 private final Context mContext; |
68 private final ChromeSigninController mChromeSigninController; | 68 private final ChromeSigninController mChromeSigninController; |
69 private final ProfileSyncService mProfileSyncService; | 69 private final ProfileSyncService mProfileSyncService; |
70 private final SyncNotificationController mSyncNotificationController; | 70 private final SyncNotificationController mSyncNotificationController; |
71 | 71 |
72 private SyncController(Context context) { | 72 private SyncController(Context context) { |
73 mContext = context; | 73 mContext = context; |
74 mChromeSigninController = ChromeSigninController.get(mContext); | 74 mChromeSigninController = ChromeSigninController.get(mContext); |
75 AndroidSyncSettings.registerObserver(context, this); | 75 AndroidSyncSettings.registerObserver(context, this); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 UniqueIdentificationGeneratorFactory.getInstance(GENERATOR_ID); | 233 UniqueIdentificationGeneratorFactory.getInstance(GENERATOR_ID); |
234 String uniqueTag = generator.getUniqueId(null); | 234 String uniqueTag = generator.getUniqueId(null); |
235 if (uniqueTag.isEmpty()) { | 235 if (uniqueTag.isEmpty()) { |
236 Log.e(TAG, "Unable to get unique tag for sync. " | 236 Log.e(TAG, "Unable to get unique tag for sync. " |
237 + "This may lead to unexpected tab sync behavior."); | 237 + "This may lead to unexpected tab sync behavior."); |
238 return; | 238 return; |
239 } | 239 } |
240 mProfileSyncService.setSessionsId(SESSION_TAG_PREFIX + uniqueTag); | 240 mProfileSyncService.setSessionsId(SESSION_TAG_PREFIX + uniqueTag); |
241 } | 241 } |
242 } | 242 } |
OLD | NEW |