| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.profiles; | 5 package org.chromium.chrome.browser.profiles; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 | 9 |
| 10 import org.chromium.base.ObserverList; | 10 import org.chromium.base.ObserverList; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 mProfiles = new ArrayList<>(); | 71 mProfiles = new ArrayList<>(); |
| 72 mAccountIds = new ArrayList<>(); | 72 mAccountIds = new ArrayList<>(); |
| 73 mImageSidePixels = new ArrayList<>(); | 73 mImageSidePixels = new ArrayList<>(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 @SuppressFBWarnings("LI_LAZY_INIT_UPDATE_STATIC") | 76 @SuppressFBWarnings("LI_LAZY_INIT_UPDATE_STATIC") |
| 77 public static PendingProfileDownloads get(Context context) { | 77 public static PendingProfileDownloads get(Context context) { |
| 78 ThreadUtils.assertOnUiThread(); | 78 ThreadUtils.assertOnUiThread(); |
| 79 if (sPendingProfileDownloads == null) { | 79 if (sPendingProfileDownloads == null) { |
| 80 sPendingProfileDownloads = new PendingProfileDownloads(); | 80 sPendingProfileDownloads = new PendingProfileDownloads(); |
| 81 AccountTrackerService.get().addSystemAccountsSeededListener( | 81 AccountTrackerService.get(context).addSystemAccountsSeededListen
er( |
| 82 sPendingProfileDownloads); | 82 sPendingProfileDownloads); |
| 83 } | 83 } |
| 84 return sPendingProfileDownloads; | 84 return sPendingProfileDownloads; |
| 85 } | 85 } |
| 86 | 86 |
| 87 public void pendProfileDownload(Profile profile, String accountId, int i
mageSidePixels) { | 87 public void pendProfileDownload(Profile profile, String accountId, int i
mageSidePixels) { |
| 88 mProfiles.add(profile); | 88 mProfiles.add(profile); |
| 89 mAccountIds.add(accountId); | 89 mAccountIds.add(accountId); |
| 90 mImageSidePixels.add(imageSidePixels); | 90 mImageSidePixels.add(imageSidePixels); |
| 91 } | 91 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 116 /** | 116 /** |
| 117 * Starts fetching the account information for a given account. | 117 * Starts fetching the account information for a given account. |
| 118 * @param context context associated with the request | 118 * @param context context associated with the request |
| 119 * @param profile Profile associated with the request | 119 * @param profile Profile associated with the request |
| 120 * @param accountId Account name to fetch the information for | 120 * @param accountId Account name to fetch the information for |
| 121 * @param imageSidePixels Request image side (in pixels) | 121 * @param imageSidePixels Request image side (in pixels) |
| 122 */ | 122 */ |
| 123 public static void startFetchingAccountInfoFor(Context context, Profile prof
ile, | 123 public static void startFetchingAccountInfoFor(Context context, Profile prof
ile, |
| 124 String accountId, int imageSidePixels, boolean isPreSignin) { | 124 String accountId, int imageSidePixels, boolean isPreSignin) { |
| 125 ThreadUtils.assertOnUiThread(); | 125 ThreadUtils.assertOnUiThread(); |
| 126 if (!AccountTrackerService.get().checkAndSeedSystemAccounts()) { | 126 if (!AccountTrackerService.get(context).checkAndSeedSystemAccounts()) { |
| 127 PendingProfileDownloads.get(context).pendProfileDownload( | 127 PendingProfileDownloads.get(context).pendProfileDownload( |
| 128 profile, accountId, imageSidePixels); | 128 profile, accountId, imageSidePixels); |
| 129 return; | 129 return; |
| 130 } | 130 } |
| 131 nativeStartFetchingAccountInfoFor(profile, accountId, imageSidePixels, i
sPreSignin); | 131 nativeStartFetchingAccountInfoFor(profile, accountId, imageSidePixels, i
sPreSignin); |
| 132 } | 132 } |
| 133 | 133 |
| 134 @CalledByNative | 134 @CalledByNative |
| 135 private static void onProfileDownloadSuccess(String accountId, String fullNa
me, | 135 private static void onProfileDownloadSuccess(String accountId, String fullNa
me, |
| 136 String givenName, Bitmap bitmap) { | 136 String givenName, Bitmap bitmap) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 164 return nativeGetCachedAvatarForPrimaryAccount(profile); | 164 return nativeGetCachedAvatarForPrimaryAccount(profile); |
| 165 } | 165 } |
| 166 | 166 |
| 167 // Native methods. | 167 // Native methods. |
| 168 private static native void nativeStartFetchingAccountInfoFor( | 168 private static native void nativeStartFetchingAccountInfoFor( |
| 169 Profile profile, String accountId, int imageSidePixels, boolean isPr
eSignin); | 169 Profile profile, String accountId, int imageSidePixels, boolean isPr
eSignin); |
| 170 private static native String nativeGetCachedFullNameForPrimaryAccount(Profil
e profile); | 170 private static native String nativeGetCachedFullNameForPrimaryAccount(Profil
e profile); |
| 171 private static native String nativeGetCachedGivenNameForPrimaryAccount(Profi
le profile); | 171 private static native String nativeGetCachedGivenNameForPrimaryAccount(Profi
le profile); |
| 172 private static native Bitmap nativeGetCachedAvatarForPrimaryAccount(Profile
profile); | 172 private static native Bitmap nativeGetCachedAvatarForPrimaryAccount(Profile
profile); |
| 173 } | 173 } |
| OLD | NEW |