This source file includes following definitions.
- CalledByNative
- onFaviconAvailable
- finalize
- destroy
- getLocalFaviconImageForURL
- getDominantColorForBitmap
- getSyncedFaviconImageForURL
- nativeInit
- nativeDestroy
- nativeGetLocalFaviconImageForURL
- nativeGetSyncedFaviconImageForURL
- nativeGetDominantColorForBitmap
package org.chromium.chrome.browser.favicon;
import android.graphics.Bitmap;
import android.graphics.Color;
import org.chromium.base.CalledByNative;
import org.chromium.chrome.browser.profiles.Profile;
public class FaviconHelper {
public static final int INVALID_ICON = 0;
public static final int FAVICON = 1 << 0;
public static final int TOUCH_ICON = 1 << 1;
public static final int TOUCH_PRECOMPOSED_ICON = 1 << 2;
private long mNativeFaviconHelper;
public interface FaviconImageCallback {
@CalledByNative("FaviconImageCallback")
public void onFaviconAvailable(Bitmap image, String iconUrl);
}
public FaviconHelper() {
mNativeFaviconHelper = nativeInit();
}
@Override
protected void finalize() {
assert mNativeFaviconHelper == 0;
}
public void destroy() {
assert mNativeFaviconHelper != 0;
nativeDestroy(mNativeFaviconHelper);
mNativeFaviconHelper = 0;
}
public boolean getLocalFaviconImageForURL(
Profile profile, String pageUrl, int iconTypes,
int desiredSizeInDip, FaviconImageCallback faviconImageCallback) {
assert mNativeFaviconHelper != 0;
return nativeGetLocalFaviconImageForURL(mNativeFaviconHelper, profile, pageUrl, iconTypes,
desiredSizeInDip, faviconImageCallback);
}
public static int getDominantColorForBitmap(Bitmap image) {
return nativeGetDominantColorForBitmap(image);
}
public Bitmap getSyncedFaviconImageForURL(Profile profile, String pageUrl) {
assert mNativeFaviconHelper != 0;
return nativeGetSyncedFaviconImageForURL(mNativeFaviconHelper, profile, pageUrl);
}
private static native long nativeInit();
private static native void nativeDestroy(long nativeFaviconHelper);
private static native boolean nativeGetLocalFaviconImageForURL(long nativeFaviconHelper,
Profile profile, String pageUrl, int iconTypes, int desiredSizeInDip,
FaviconImageCallback faviconImageCallback);
private static native Bitmap nativeGetSyncedFaviconImageForURL(long nativeFaviconHelper,
Profile profile, String pageUrl);
private static native int nativeGetDominantColorForBitmap(Bitmap image);
}