-
-
Save agi90/cd8fbd5dcfa8131db279ff9384c6ab5c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppDownload { | |
WebExtension.DownloadItem mExtensionDownload; | |
// Cancels the download | |
GeckoResult<Void> cancel() { | |
// Actually cancel the download | |
// Notifies extension | |
return mExtensionDownload.update().canceled(true).commit(); | |
} | |
void setDownloadItem(DownloadItem item) { | |
mExtensionDownload = item; | |
} | |
} | |
class AppDownloadController { | |
// stuff ... | |
@Override | |
onCancel(DownloadItem item, WebExtension extension) { | |
AppDownload download = mDownloads.byDownloadItem(item); | |
// Update the download item in case it's out of date | |
download.setDownloadItem(item); | |
return download.cancel(); | |
} | |
} | |
// UI Code | |
onClick() { | |
mDownload.cancel(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment