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