branch->GetIntPref(DOWNLOAD_MANAGER_BEHAVIOR_PREF, &behavior);
  NS_IMETHODIMP Init(nsIURI* aSource,                     nsILocalFile* aTarget,                     const PRUnichar* aDisplayName,                     nsIMIMEInfo *aMIMEInfo,                     PRInt64 aStartTime,                     nsIWebBrowserPersist* aPersist) {    nsresult rv;    nsCOMPtr<nsIDownloadManager> dm = do_GetService("@mozilla.org/download-manager;1", &rv);    if (NS_FAILED(rv)) return rv;        rv = dm->AddDownload(aSource, aTarget, aDisplayName, aMIMEInfo, aStartTime, aPersist, getter_AddRefs(mInner));    if (NS_FAILED(rv)) return rv;    PRInt32 behavior = 0;    nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);    if (NS_FAILED(rv)) return rv;    nsCOMPtr<nsIPrefBranch> branch = do_QueryInterface(prefs);    branch->GetIntPref(DOWNLOAD_MANAGER_BEHAVIOR_PREF, &behavior);    if (behavior == 0)      return dm->Open(nsnull, this);    if (behavior == 1) {      nsAutoString path;      rv = aTarget->GetPath(path);      if (NS_FAILED(rv)) return rv;      NS_ConvertUCS2toUTF8 utf8Path(path);      return dm->OpenProgressDialogFor(utf8Path, nsnull, PR_TRUE);    }    return rv;  }