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

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: 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..bc015fd70784562cd4aff8e5e99acada6f60f1c9 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;
+ } else if (!download_->GetWebContents()) {
asanka 2016/07/07 21:12:48 Nit: 'else' unnecessary.
qinmin 2016/07/07 22:49:37 Done.
+ // 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.
Yaron 2016/07/07 19:24:23 aren't you fixing this? OnDownloadCanceled will to
qinmin 2016/07/07 21:09:47 Done.
+ 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