B2G/gecko/browser/components/downloads/src/DownloadsCommon.jsm
/**
   * Returns the view item associated with the provided data item for this view.
   *
   * @param aDataItem
   *        DownloadsDataItem object for which the view item is requested.
   *
   * @return Object that can be used to notify item status events.
   */
Returns the view item associated with the provided data item for this view.
@param aDataItem
DownloadsDataItem object for which the view item is requested.

@return Object that can be used to notify item status events.
Returns the view item associated with the provided data item for this view . @param aDataItem DownloadsDataItem object for which the view item is requested . @return Object that can be used to notify item status events .
function DID_getViewItem(aDataItem)
  {
    return Object.freeze({
      onStateChange: function DIVI_onStateChange()
      {
        if (aDataItem.state == nsIDM.DOWNLOAD_FINISHED ||
            aDataItem.state == nsIDM.DOWNLOAD_FAILED) {
          DownloadsIndicatorData.attention = true;
        }
        DownloadsIndicatorData._lastRawTimeLeft = -1;
        DownloadsIndicatorData._lastTimeLeft = -1;
        DownloadsIndicatorData._updateViews();
      },
      onProgressChange: function DIVI_onProgressChange()
      {
        DownloadsIndicatorData._updateViews();
      }
    });
  }
function DID_getViewItem ( aDataItem ) { return Object . freeze ( { onStateChange : function DIVI_onStateChange ( ) { if ( aDataItem . state == nsIDM . DOWNLOAD_FINISHED || aDataItem . state == nsIDM . DOWNLOAD_FAILED ) { DownloadsIndicatorData . attention = true ; } DownloadsIndicatorData . _lastRawTimeLeft = - 1 ; DownloadsIndicatorData . _lastTimeLeft = - 1 ; DownloadsIndicatorData . _updateViews ( ) ; } , onProgressChange : function DIVI_onProgressChange ( ) { DownloadsIndicatorData . _updateViews ( ) ; } } ) ; }
Returns the view item associated with the provided data item for this view.
Returns the view item associated with the provided data item for this view .
// Since the state of a download changed, reset the estimated time left.