This source file includes following definitions.
- onProfileDownloaded
- addObserver
- removeObserver
- startFetchingAccountInfoFor
- onProfileDownloadSuccess
- getCachedName
- getCachedAvatar
- nativeStartFetchingAccountInfoFor
- nativeGetCachedNameForPrimaryAccount
- nativeGetCachedAvatarForPrimaryAccount
package org.chromium.chrome.browser.profiles;
import android.graphics.Bitmap;
import org.chromium.base.CalledByNative;
import org.chromium.base.ObserverList;
import org.chromium.base.ThreadUtils;
public class ProfileDownloader {
private static final ObserverList<Observer> sObservers = new ObserverList<Observer>();
public interface Observer {
void onProfileDownloaded(String accountId, String fullName, Bitmap bitmap);
}
public static void addObserver(Observer observer) {
sObservers.addObserver(observer);
}
public static void removeObserver(Observer observer) {
sObservers.removeObserver(observer);
}
public static void startFetchingAccountInfoFor(
Profile profile, String accountId, int imageSidePixels) {
ThreadUtils.assertOnUiThread();
nativeStartFetchingAccountInfoFor(profile, accountId, imageSidePixels);
}
@CalledByNative
private static void onProfileDownloadSuccess(String accountId, String fullName, Bitmap bitmap) {
ThreadUtils.assertOnUiThread();
for (Observer observer : sObservers) {
observer.onProfileDownloaded(accountId, fullName, bitmap);
}
}
public static String getCachedName(Profile profile) {
return nativeGetCachedNameForPrimaryAccount(profile);
}
public static Bitmap getCachedAvatar(Profile profile) {
return nativeGetCachedAvatarForPrimaryAccount(profile);
}
private static native void nativeStartFetchingAccountInfoFor(
Profile profile, String accountId, int imageSidePixels);
private static native String nativeGetCachedNameForPrimaryAccount(Profile profile);
private static native Bitmap nativeGetCachedAvatarForPrimaryAccount(Profile profile);
}