Search in sources :

Example 1 with DownloadNotifier

use of org.chromium.chrome.browser.download.DownloadNotifier in project AndroidChromium by JackyAndroid.

the class OfflinePageNotificationBridge method notifyDownloadProgress.

/**
     * Called by offline page backend to notify the user of download progress.
     * @param context Context to show notifications.
     * @param guid GUID of a request to download a page related to the notification.
     * @param url URL of the page to download.
     * @param startTime Time of the request.
     * @param displayName Name to be displayed on notification.
     */
@CalledByNative
public static void notifyDownloadProgress(Context context, String guid, String url, long startTime, String displayName) {
    DownloadNotifier notifier = getDownloadNotifier(context);
    if (notifier == null)
        return;
    DownloadInfo downloadInfo = new DownloadInfo.Builder().setIsOfflinePage(true).setDownloadGuid(guid).setFileName(displayName).setFilePath(url).setPercentCompleted(-1).setIsOffTheRecord(false).setIsResumable(true).setTimeRemainingInMillis(0).build();
    notifier.notifyDownloadProgress(downloadInfo, startTime, false);
}
Also used : DownloadNotifier(org.chromium.chrome.browser.download.DownloadNotifier) DownloadInfo(org.chromium.chrome.browser.download.DownloadInfo) CalledByNative(org.chromium.base.annotations.CalledByNative)

Example 2 with DownloadNotifier

use of org.chromium.chrome.browser.download.DownloadNotifier in project AndroidChromium by JackyAndroid.

the class OfflinePageNotificationBridge method notifyDownloadInterrupted.

/**
     * Update download notification to interrupted.
     * @param context Context to show notifications.
     * @param guid GUID of a request to download a page related to the notification.
     * @param displayName Name to be displayed on notification.
     */
@CalledByNative
public static void notifyDownloadInterrupted(Context context, String guid, String displayName) {
    DownloadNotifier notifier = getDownloadNotifier(context);
    if (notifier == null)
        return;
    DownloadInfo downloadInfo = new DownloadInfo.Builder().setIsOfflinePage(true).setDownloadGuid(guid).setFileName(displayName).setIsResumable(true).build();
    notifier.notifyDownloadInterrupted(downloadInfo, true);
}
Also used : DownloadNotifier(org.chromium.chrome.browser.download.DownloadNotifier) DownloadInfo(org.chromium.chrome.browser.download.DownloadInfo) CalledByNative(org.chromium.base.annotations.CalledByNative)

Example 3 with DownloadNotifier

use of org.chromium.chrome.browser.download.DownloadNotifier in project AndroidChromium by JackyAndroid.

the class OfflinePageNotificationBridge method notifyDownloadPaused.

/**
     * Update download notification to paused.
     * @param context Context to show notifications.
     * @param guid GUID of a request to download a page related to the notification.
     * @param displayName Name to be displayed on notification.
     */
@CalledByNative
public static void notifyDownloadPaused(Context context, String guid, String displayName) {
    DownloadNotifier notifier = getDownloadNotifier(context);
    if (notifier == null)
        return;
    DownloadInfo downloadInfo = new DownloadInfo.Builder().setIsOfflinePage(true).setDownloadGuid(guid).setFileName(displayName).build();
    notifier.notifyDownloadPaused(downloadInfo);
}
Also used : DownloadNotifier(org.chromium.chrome.browser.download.DownloadNotifier) DownloadInfo(org.chromium.chrome.browser.download.DownloadInfo) CalledByNative(org.chromium.base.annotations.CalledByNative)

Example 4 with DownloadNotifier

use of org.chromium.chrome.browser.download.DownloadNotifier in project AndroidChromium by JackyAndroid.

the class OfflinePageNotificationBridge method notifyDownloadCanceled.

/**
     * Update download notification to canceled.
     * @param context Context to show notifications.
     * @param guid GUID of a request to download a page related to the notification.
     */
@CalledByNative
public static void notifyDownloadCanceled(Context context, String guid) {
    DownloadNotifier notifier = getDownloadNotifier(context);
    if (notifier == null)
        return;
    notifier.notifyDownloadCanceled(guid);
}
Also used : DownloadNotifier(org.chromium.chrome.browser.download.DownloadNotifier) CalledByNative(org.chromium.base.annotations.CalledByNative)

Example 5 with DownloadNotifier

use of org.chromium.chrome.browser.download.DownloadNotifier in project AndroidChromium by JackyAndroid.

the class OfflinePageNotificationBridge method notifyDownloadFailed.

/**
     * Update download notification to failure.
     * @param context Context to show notifications.
     * @param guid GUID of a request to download a page related to the notification.
     * @param url URL of the page to download.
     * @param displayName Name to be displayed on notification.
     */
@CalledByNative
public static void notifyDownloadFailed(Context context, String guid, String url, String displayName) {
    DownloadNotifier notifier = getDownloadNotifier(context);
    if (notifier == null)
        return;
    DownloadInfo downloadInfo = new DownloadInfo.Builder().setIsOfflinePage(true).setDownloadGuid(guid).setFileName(displayName).build();
    notifier.notifyDownloadFailed(downloadInfo);
}
Also used : DownloadNotifier(org.chromium.chrome.browser.download.DownloadNotifier) DownloadInfo(org.chromium.chrome.browser.download.DownloadInfo) CalledByNative(org.chromium.base.annotations.CalledByNative)

Aggregations

CalledByNative (org.chromium.base.annotations.CalledByNative)6 DownloadNotifier (org.chromium.chrome.browser.download.DownloadNotifier)6 DownloadInfo (org.chromium.chrome.browser.download.DownloadInfo)5