sbBaseMediaItemDownloadJob Class Reference

#include <sbBaseMediaItemDownloadJob.h>

Inheritance diagram for sbBaseMediaItemDownloadJob:
[legend]
Collaboration diagram for sbBaseMediaItemDownloadJob:
[legend]

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_SBIMEDIAITEMDOWNLOADJOB
NS_DECL_SBIJOBPROGRESS
NS_DECL_SBIJOBCANCELABLE
virtual
NS_DECL_SBIFILEDOWNLOADERLISTENER 
~sbBaseMediaItemDownloadJob ()
 
- Public Member Functions inherited from sbIMediaItemDownloadJob
void start ()
 
- Public Member Functions inherited from sbIJobProgress
nsIStringEnumerator getErrorMessages ()
 Enumerate all the errors encountered during the job. More...
 
void addJobProgressListener (in sbIJobProgressListener aListener)
 Add a listener to be notified when significant job progress has been made. More...
 
void removeJobProgressListener (in sbIJobProgressListener aListener)
 Remove a previously added listener. More...
 
- Public Member Functions inherited from sbIJobCancelable
void cancel ()
 Attempt to cancel the job Throws NS_ERROR_FAILURE if canceling fails. More...
 
- Public Member Functions inherited from sbIFileDownloaderListener
void onProgress ()
 Called when progress is made on file download. More...
 
void onComplete ()
 Called when download has completed. More...
 

Protected Member Functions

virtual nsresult Start (nsIURI *aURI)
 
virtual nsresult Stop ()
 
virtual nsresult GetDownloadURI (nsIURI **aURI)
 
virtual nsresult Initialize ()
 
 sbBaseMediaItemDownloadJob (sbIMediaItem *aMediaItem, sbILibrary *aTargetLibrary=nsnull)
 

Protected Attributes

PRLock * mLock
 
nsCOMPtr< sbIMediaItemmMediaItem
 
nsCOMPtr< sbIMutablePropertyArraymProperties
 
nsCOMPtr< sbILibrarymTargetLibrary
 
nsCOMPtr< sbIFileDownloadermFileDownloader
 
nsCOMPtr< sbITemporaryFileFactorymTemporaryFileFactory
 
nsTArray< nsCOMPtr
< sbIJobProgressListener > > 
mListenerList
 
PRUint16 mStatus
 

Additional Inherited Members

- Public Attributes inherited from sbIMediaItemDownloadJob
readonly attribute nsIFile downloadedFile
 
readonly attribute sbIPropertyArray properties
 
attribute sbITemporaryFileFactory temporaryFileFactory
 
- Public Attributes inherited from sbIJobProgress
const unsigned short STATUS_FAILED = 0x00
 Constant indicating that the job has completed with errors. More...
 
const unsigned short STATUS_SUCCEEDED = 0x10
 Constant indicating that the job has completed. More...
 
const unsigned short STATUS_RUNNING = 0x20
 Constant indicating that the job is active. More...
 
readonly attribute unsigned short status
 Current status of the job. More...
 
readonly attribute boolean blocked
 If true, progress of job is blocked (e.g., due to locked resource). More...
 
readonly attribute AString statusText
 Localized message describing the status of the job. More...
 
readonly attribute AString titleText
 Localized message describing the type or purpose of the job. More...
 
readonly attribute unsigned long progress
 Number of work units completed. More...
 
readonly attribute unsigned long total
 Total number of work units to be completed May be set to 0 if the job length is indeterminate. More...
 
readonly attribute unsigned long errorCount
 Number of errors that have been encountered. More...
 
- Public Attributes inherited from sbIJobCancelable
readonly attribute boolean canCancel
 True if it is possible to cancel the job. More...
 

Detailed Description

This class provides a base class implementation of sbIMediaItemDownloadJob for downloaders that can download using the sbFileDownloader component.

Definition at line 78 of file sbBaseMediaItemDownloadJob.h.

Constructor & Destructor Documentation

sbBaseMediaItemDownloadJob::~sbBaseMediaItemDownloadJob ( )
virtual

Destroy a Base media item download job instance.

Definition at line 630 of file sbBaseMediaItemDownloadJob.cpp.

sbBaseMediaItemDownloadJob::sbBaseMediaItemDownloadJob ( sbIMediaItem aMediaItem,
sbILibrary aTargetLibrary = nsnull 
)
protected

Construct a base media item download job object to download the media item specified by aMediaItem for the library specified by aTargetLibrary. If aLibrary is not specified, download media item for the main library.

Parameters
aMediaItemMedia item to download.
aTargetLibraryLibrary for which the media item will be downloaded.

Definition at line 779 of file sbBaseMediaItemDownloadJob.cpp.

Member Function Documentation

nsresult sbBaseMediaItemDownloadJob::GetDownloadURI ( nsIURI **  aURI)
protectedvirtual

Return the download source URI in aURI. This method is intended to be overridden by sub-classes. The default implementation uses the download media item content source.

Parameters
aURIReturned download source URI.

Definition at line 725 of file sbBaseMediaItemDownloadJob.cpp.

nsresult sbBaseMediaItemDownloadJob::Initialize ( )
protectedvirtual

Initialize a base media item download job.

Definition at line 754 of file sbBaseMediaItemDownloadJob.cpp.

nsresult sbBaseMediaItemDownloadJob::Start ( nsIURI *  aURI)
protectedvirtual

Start downloading from the source URI specified by aURI. Sub-classes that need to make network requests to get the source URI can override sbIMediaItemDownloadJob.Start, get the source URI, and then call this Start method when the source URI is available.

Parameters
aURISource URI from which to download.

Definition at line 653 of file sbBaseMediaItemDownloadJob.cpp.

Here is the call graph for this function:

nsresult sbBaseMediaItemDownloadJob::Stop ( )
protectedvirtual

Stop downloading. Sub-classes that need to do special actions on stop may override this method and then call the base class version.

Definition at line 709 of file sbBaseMediaItemDownloadJob.cpp.

Member Data Documentation

nsCOMPtr<sbIFileDownloader> sbBaseMediaItemDownloadJob::mFileDownloader
protected

Definition at line 137 of file sbBaseMediaItemDownloadJob.h.

nsTArray< nsCOMPtr<sbIJobProgressListener> > sbBaseMediaItemDownloadJob::mListenerList
protected

Definition at line 141 of file sbBaseMediaItemDownloadJob.h.

PRLock* sbBaseMediaItemDownloadJob::mLock
protected

Definition at line 132 of file sbBaseMediaItemDownloadJob.h.

nsCOMPtr<sbIMediaItem> sbBaseMediaItemDownloadJob::mMediaItem
protected

Definition at line 133 of file sbBaseMediaItemDownloadJob.h.

nsCOMPtr<sbIMutablePropertyArray> sbBaseMediaItemDownloadJob::mProperties
protected

Definition at line 135 of file sbBaseMediaItemDownloadJob.h.

PRUint16 sbBaseMediaItemDownloadJob::mStatus
protected

Definition at line 142 of file sbBaseMediaItemDownloadJob.h.

nsCOMPtr<sbILibrary> sbBaseMediaItemDownloadJob::mTargetLibrary
protected

Definition at line 136 of file sbBaseMediaItemDownloadJob.h.

nsCOMPtr<sbITemporaryFileFactory> sbBaseMediaItemDownloadJob::mTemporaryFileFactory
protected

Definition at line 139 of file sbBaseMediaItemDownloadJob.h.


The documentation for this class was generated from the following files: