Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / android / java / src / org / chromium / chrome / browser / profiles / ProfileDownloader.java
index 0f61ddd..416e164 100644 (file)
@@ -26,9 +26,11 @@ public class ProfileDownloader {
          * Notifies that an account data in the profile has been updated.
          * @param accountId An account ID.
          * @param fullName A full name.
+         * @param givenName A given name.
          * @param bitmap A user picture.
          */
-        void onProfileDownloaded(String accountId, String fullName, Bitmap bitmap);
+        void onProfileDownloaded(String accountId, String fullName, String givenName,
+                Bitmap bitmap);
     }
 
     /**
@@ -60,14 +62,42 @@ public class ProfileDownloader {
     }
 
     @CalledByNative
-    private static void onProfileDownloadSuccess(String accountId, String fullName, Bitmap bitmap) {
+    private static void onProfileDownloadSuccess(String accountId, String fullName,
+            String givenName, Bitmap bitmap) {
         ThreadUtils.assertOnUiThread();
         for (Observer observer : sObservers) {
-            observer.onProfileDownloaded(accountId, fullName, bitmap);
+            observer.onProfileDownloaded(accountId, fullName, givenName, bitmap);
         }
     }
 
+    /**
+     * @param profile Profile
+     * @return The profile full name if cached, or null.
+     */
+    public static String getCachedFullName(Profile profile) {
+        return nativeGetCachedFullNameForPrimaryAccount(profile);
+    }
+
+    /**
+     * @param profile Profile
+     * @return The profile given name if cached, or null.
+     */
+    public static String getCachedGivenName(Profile profile) {
+        return nativeGetCachedGivenNameForPrimaryAccount(profile);
+    }
+
+    /**
+     * @param profile Profile
+     * @return The profile avatar if cached, or null.
+     */
+    public static Bitmap getCachedAvatar(Profile profile) {
+        return nativeGetCachedAvatarForPrimaryAccount(profile);
+    }
+
     // Native methods.
     private static native void nativeStartFetchingAccountInfoFor(
             Profile profile, String accountId, int imageSidePixels);
+    private static native String nativeGetCachedFullNameForPrimaryAccount(Profile profile);
+    private static native String nativeGetCachedGivenNameForPrimaryAccount(Profile profile);
+    private static native Bitmap nativeGetCachedAvatarForPrimaryAccount(Profile profile);
 }