blob: f12d9a916a2298d4675a1fc6a5b0144db4ddce09 [file] [log] [blame]
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.weblayer;
import android.graphics.Bitmap;
import android.webkit.ValueCallback;
import androidx.annotation.NonNull;
/**
* Used to intercept interaction with GAIA accounts.
*
* @since 86
*/
public abstract class GoogleAccountsCallback {
/**
* Called when a user wants to change the state of their GAIA account. This could be a signin,
* signout, or any other action. See {@link GoogleAccountServiceType} for all the possible
* actions.
*/
public abstract void onGoogleAccountsRequest(@NonNull GoogleAccountsParams params);
/**
* The current GAIA ID the user is signed in with, or empty if the user is signed out. This can
* be provided on a best effort basis if the ID is not available immediately.
*/
public abstract @NonNull String getGaiaId();
/**
* Returns the full name of the signed-in user, or empty if the user is signed out. This can
* be provided on a best effort basis if the name is not available immediately.
* @since 87
*/
public @NonNull String getFullName() {
return new String();
}
/**
* Called to retrieve the signed-in user's avatar.
* @param desiredSize the size the avatar will be displayed at, in raw pixels. If a different
* size avatar is returned, WebLayer will scale the returned image.
* @param avatarLoadedCallback to be called with the avatar when it is available (synchronously
* or asynchronously). Until such time that it's called, WebLayer will fall back to a
* monogram based on {@link getFullName()}, e.g. encircled "JD" for "Jill Doe".
* @since 87
*/
public void getAvatar(int desiredSize, @NonNull ValueCallback<Bitmap> avatarLoadedCallback) {}
}