mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Bug 294056 User-specified sound fails to play after file download completes
r=biesi sr=neil
This commit is contained in:
parent
0f7e4ceabf
commit
b30dc8ce33
@ -60,7 +60,6 @@
|
||||
#include "nsIPromptService.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIProfileChangeStatus.h"
|
||||
#include "nsISound.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIFileURL.h"
|
||||
#ifndef MOZ_THUNDERBIRD
|
||||
@ -1233,16 +1232,18 @@ nsDownload::OnStateChange(nsIWebProgress* aWebProgress,
|
||||
}
|
||||
|
||||
if (!soundStr.IsEmpty()) {
|
||||
nsCOMPtr<nsISound> snd = do_CreateInstance("@mozilla.org/sound;1");
|
||||
if (snd) {
|
||||
if (!mDownloadManager->mSoundInterface) {
|
||||
mDownloadManager->mSoundInterface = do_CreateInstance("@mozilla.org/sound;1");
|
||||
}
|
||||
if (mDownloadManager->mSoundInterface) {
|
||||
nsCOMPtr<nsIURI> soundURI;
|
||||
|
||||
NS_NewURI(getter_AddRefs(soundURI), soundStr);
|
||||
nsCOMPtr<nsIURL> soundURL(do_QueryInterface(soundURI));
|
||||
if (soundURL)
|
||||
snd->Play(soundURL);
|
||||
mDownloadManager->mSoundInterface->Play(soundURL);
|
||||
else
|
||||
snd->Beep();
|
||||
mDownloadManager->mSoundInterface->Beep();
|
||||
}
|
||||
}
|
||||
if (showAlert)
|
||||
|
@ -58,6 +58,7 @@
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsIProgressDialog.h"
|
||||
#include "nsIMIMEInfo.h"
|
||||
#include "nsISound.h"
|
||||
|
||||
enum DownloadState { NOTSTARTED = -1, DOWNLOADING, FINISHED, FAILED, CANCELED };
|
||||
|
||||
@ -89,6 +90,8 @@ protected:
|
||||
nsresult DownloadEnded(const nsACString& aTargetPath, const PRUnichar* aMessage);
|
||||
PRBool MustUpdateUI() { if (mDocument) return PR_TRUE; return PR_FALSE; }
|
||||
|
||||
nsCOMPtr<nsISound> mSoundInterface;
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIRDFDataSource> mDataSource;
|
||||
nsCOMPtr<nsIDOMDocument> mDocument;
|
||||
|
Loading…
x
Reference in New Issue
Block a user