Bug 1070488 - Add files downloaded in private browsing to the Android Download Manager. r=paolo

This commit is contained in:
wesj 2014-10-08 21:55:00 -07:00
Родитель cddb3f663b
Коммит 6f886c7e8c
2 изменённых файлов: 20 добавлений и 11 удалений

Просмотреть файл

@ -2773,7 +2773,18 @@ nsDownload::SetState(DownloadState aState)
bool addToRecentDocs = true;
if (pref)
pref->GetBoolPref(PREF_BDM_ADDTORECENTDOCS, &addToRecentDocs);
#ifdef MOZ_WIDGET_ANDROID
if (addToRecentDocs) {
nsCOMPtr<nsIMIMEInfo> mimeInfo;
nsAutoCString contentType;
GetMIMEInfo(getter_AddRefs(mimeInfo));
if (mimeInfo)
mimeInfo->GetMIMEType(contentType);
mozilla::widget::android::DownloadsIntegration::ScanMedia(path, NS_ConvertUTF8toUTF16(contentType));
}
#else
if (addToRecentDocs && !mPrivate) {
#ifdef XP_WIN
::SHAddToRecentDocs(SHARD_PATHW, path.get());
@ -2786,17 +2797,9 @@ nsDownload::SetState(DownloadState aState)
gtk_recent_manager_add_item(manager, uri);
g_free(uri);
}
#elif defined(MOZ_WIDGET_ANDROID)
nsCOMPtr<nsIMIMEInfo> mimeInfo;
nsAutoCString contentType;
GetMIMEInfo(getter_AddRefs(mimeInfo));
if (mimeInfo)
mimeInfo->GetMIMEType(contentType);
mozilla::widget::android::DownloadsIntegration::ScanMedia(path, NS_ConvertUTF8toUTF16(contentType));
#endif
}
#endif
#ifdef MOZ_ENABLE_GIO
// Use GIO to store the source URI for later display in the file manager.
GFile* gio_file = g_file_new_for_path(NS_ConvertUTF16toUTF8(path).get());
@ -2814,6 +2817,7 @@ nsDownload::SetState(DownloadState aState)
#endif
}
#endif
#ifdef XP_MACOSX
// On OS X, make the downloads stack bounce.
CFStringRef observedObject = ::CFStringCreateWithCString(kCFAllocatorDefault,

Просмотреть файл

@ -82,6 +82,11 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIFile* aTarget,
// list, with a pref to disable.
{
bool addToRecentDocs = Preferences::GetBool(PREF_BDM_ADDTORECENTDOCS);
#ifdef MOZ_WIDGET_ANDROID
if (addToRecentDocs) {
mozilla::widget::android::DownloadsIntegration::ScanMedia(path, NS_ConvertUTF8toUTF16(aContentType));
}
#else
if (addToRecentDocs && !aIsPrivate) {
#ifdef XP_WIN
::SHAddToRecentDocs(SHARD_PATHW, path.get());
@ -94,10 +99,9 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIFile* aTarget,
gtk_recent_manager_add_item(manager, uri);
g_free(uri);
}
#elif MOZ_WIDGET_ANDROID
mozilla::widget::android::DownloadsIntegration::ScanMedia(path, NS_ConvertUTF8toUTF16(aContentType));
#endif
}
#endif
#ifdef MOZ_ENABLE_GIO
// Use GIO to store the source URI for later display in the file manager.
GFile* gio_file = g_file_new_for_path(NS_ConvertUTF16toUTF8(path).get());
@ -115,6 +119,7 @@ nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIFile* aTarget,
#endif
}
#endif
#ifdef XP_MACOSX
// On OS X, make the downloads stack bounce.
CFStringRef observedObject = ::CFStringCreateWithCString(kCFAllocatorDefault,