53 #include <nsAutoLock.h>
54 #include <nsAutoPtr.h>
81 NS_ENSURE_ARG_POINTER(aJobProgress);
87 if (mDeviceStatusHelper) {
91 rv = aJobProgress->GetProgress(&progress);
92 NS_ENSURE_SUCCESS(rv, rv);
93 rv = aJobProgress->GetTotal(&total);
94 NS_ENSURE_SUCCESS(rv, rv);
98 mDeviceStatusHelper->ItemProgress(static_cast<double>(progress) /
99 static_cast<double>(total));
105 rv = aJobProgress->GetStatus(&status);
106 NS_ENSURE_SUCCESS(rv, rv);
110 if (mCompleteNotifyMonitor) {
111 nsAutoMonitor monitor(mCompleteNotifyMonitor);
112 PR_AtomicSet(&mIsComplete, 1);
116 PR_AtomicSet(&mIsComplete, 1);
138 PRMonitor* aCompleteNotifyMonitor,
142 NS_ENSURE_ARG_POINTER(aDeviceProgressListener);
145 nsRefPtr<sbDeviceProgressListener>
147 aDeviceStatusHelper);
148 NS_ENSURE_TRUE(listener, NS_ERROR_OUT_OF_MEMORY);
151 listener.forget(aDeviceProgressListener);
175 (PRMonitor* aCompleteNotifyMonitor,
177 mCompleteNotifyMonitor(aCompleteNotifyMonitor),
178 mDeviceStatusHelper(aDeviceStatusHelper),
179 mIsComplete(PR_FALSE)
NS_DECL_ISUPPORTS static NS_DECL_SBIJOBPROGRESSLISTENER nsresult New(sbDeviceProgressListener **aDeviceProgressListener, PRMonitor *aCompleteNotifyMonitor=nsnull, sbDeviceStatusHelper *aDeviceStatusHelper=nsnull)
Generic interface for exposing long running jobs to the UI.
virtual ~sbDeviceProgressListener()
const unsigned short STATUS_RUNNING
Constant indicating that the job is active.
Songbird Device Progress Listener Definitions.
NS_IMPL_THREADSAFE_ISUPPORTS1(sbDeviceCapsCompatibility, sbIDeviceCapsCompatibility) sbDeviceCapsCompatibility
sbDeviceProgressListener(PRMonitor *aCompleteNotifyMonitor, sbDeviceStatusHelper *aDeviceStatusHelper)
Songbird Device Status Services Definitions.
Implemented to receive notifications from sbIJobProgress interfaces.