This code implements:

a) The options "Open", "Share", "Set as ringtone" are displayed to user for example
b) User chooses one so the DownloadHelper calculates the mime type, blob, etc... if there are a problem about file not supported, not exists, etc.. the "onerror" callback is invoked
c) Download Manager will show a dialog displaying the error description and two buttons "Keep file" and "Delete"