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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java

Issue 2019533002: [Android] Fix crash when closing tab during infobar cancellation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test on mobile Created 4 years, 7 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/infobar/SimpleConfirmInfoBarBuilder.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
index 7921771a81372d8c25470dd2dacad21928ac22b3..26e1691391d3170f225c49b2c6807f423cf88e02 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
@@ -56,15 +56,16 @@ public class ChromeDownloadDelegate implements ContentViewDownloadDelegate {
private class DangerousDownloadListener implements SimpleConfirmInfoBarBuilder.Listener {
@Override
- public void onInfoBarButtonClicked(boolean confirm) {
+ public boolean onInfoBarButtonClicked(boolean confirm) {
assert mTab != null;
- if (mPendingRequest == null) return;
+ if (mPendingRequest == null) return false;
if (mPendingRequest.getDownloadGuid() != null) {
nativeDangerousDownloadValidated(mTab, mPendingRequest.getDownloadGuid(), confirm);
if (confirm) {
showDownloadStartNotification();
}
- closeBlankTab();
+ mPendingRequest = null;
+ return closeBlankTab();
} else if (confirm) {
// User confirmed the download.
if (mPendingRequest.isGETRequest()) {
@@ -96,13 +97,16 @@ public class ChromeDownloadDelegate implements ContentViewDownloadDelegate {
DownloadManagerService.getDownloadManagerService(mContext).onDownloadCompleted(
newDownloadInfo);
}
+ mPendingRequest = null;
+ return false;
} else {
// User did not accept the download, discard the file if it is a POST download.
if (!mPendingRequest.isGETRequest()) {
discardFile(mPendingRequest.getFilePath());
}
+ mPendingRequest = null;
+ return closeBlankTab();
}
- mPendingRequest = null;
}
@Override
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/infobar/SimpleConfirmInfoBarBuilder.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698