Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4693)

Unified Diff: chrome/browser/download/download_target_determiner.cc

Issue 2117343007: Show download error message if sdcard is not available (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clean up document dir if no sdcard is found Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/download/download_target_determiner.cc
diff --git a/chrome/browser/download/download_target_determiner.cc b/chrome/browser/download/download_target_determiner.cc
index 0c13dcd669467f724a7075fea077b136bc8f5f1e..e4636cd465250817c98e73a7ee85da67dfc097a3 100644
--- a/chrome/browser/download/download_target_determiner.cc
+++ b/chrome/browser/download/download_target_determiner.cc
@@ -40,6 +40,11 @@
#include "content/public/common/webplugininfo.h"
#endif
+#if defined(OS_ANDROID)
+#include "chrome/browser/android/download/download_controller.h"
+#include "chrome/browser/android/download/download_manager_service.h"
+#endif
+
#if defined(OS_WIN)
#include "chrome/browser/ui/pdf/adobe_reader_info_win.h"
#endif
@@ -317,13 +322,24 @@ void DownloadTargetDeterminer::ReserveVirtualPathDone(
<< " Verified:" << verified;
DCHECK_EQ(STATE_PROMPT_USER_FOR_DOWNLOAD_PATH, next_state_);
#if BUILDFLAG(ANDROID_JAVA_UI)
- // If we cannot reserve the path and the WebContent is already gone, there is
- // no way to prompt user for an infobar. This could happen when user try to
- // resume a download after another process has overwritten the same file.
- // TODO(qinmin): show an error toast to the user. http://crbug.com/581106.
- if (!verified && !download_->GetWebContents()) {
- CancelOnFailureAndDeleteSelf();
- return;
+ if (!verified) {
+ if (path.empty()) {
+ CancelOnFailureAndDeleteSelf();
+ DownloadManagerService::OnDownloadCanceled(
+ download_, DownloadController::CANCEL_REASON_NO_EXTERNAL_STORAGE);
+ return;
+ }
+ if (!download_->GetWebContents()) {
+ // If we cannot reserve the path and the WebContent is already gone, there
+ // is no way to prompt user for an infobar. This could happen when user
+ // try to resume a download after another process has overwritten the same
+ // file.
asanka 2016/07/12 17:07:10 This comment seems wrong. How does a resumption at
qinmin 2016/07/12 18:13:04 should use created instead of overwritten. When re
+ CancelOnFailureAndDeleteSelf();
+ DownloadManagerService::OnDownloadCanceled(
+ download_,
+ DownloadController::CANCEL_REASON_CANNOT_DETERMINE_DOWNLOAD_TARGET);
+ return;
+ }
}
#endif
should_prompt_ = (should_prompt_ || !verified);

Powered by Google App Engine
This is Rietveld 408576698