| Index: chrome/browser/download/download_request_manager.cc
|
| diff --git a/chrome/browser/download/download_request_manager.cc b/chrome/browser/download/download_request_manager.cc
|
| index 83811e2693ad079c2f94ebc9af7ce9b7fc86b61e..50d4e3c7daea14e3581c466603f578cdaa494f98 100644
|
| --- a/chrome/browser/download/download_request_manager.cc
|
| +++ b/chrome/browser/download/download_request_manager.cc
|
| @@ -58,19 +58,22 @@ void DownloadRequestManager::TabDownloadState::OnUserGesture() {
|
| }
|
| }
|
|
|
| -void DownloadRequestManager::TabDownloadState::PromptUserForDownload(
|
| +bool DownloadRequestManager::TabDownloadState::PromptUserForDownload(
|
| TabContents* tab,
|
| DownloadRequestManager::Callback* callback) {
|
| callbacks_.push_back(callback);
|
|
|
| if (is_showing_prompt())
|
| - return; // Already showing prompt.
|
| + return true; // Already showing prompt.
|
|
|
| if (DownloadRequestManager::delegate_) {
|
| NotifyCallbacks(DownloadRequestManager::delegate_->ShouldAllowDownload());
|
| } else {
|
| dialog_delegate_ = DownloadRequestDialogDelegate::Create(tab, this);
|
| + if (!dialog_delegate_)
|
| + return false;
|
| }
|
| + return true;
|
| }
|
|
|
| void DownloadRequestManager::TabDownloadState::Cancel() {
|
| @@ -261,7 +264,11 @@ void DownloadRequestManager::CanDownloadImpl(
|
| break;
|
|
|
| case PROMPT_BEFORE_DOWNLOAD:
|
| - state->PromptUserForDownload(effective_tab, callback);
|
| + // Conceivably, for some reason (e.g., already have another tab-modal
|
| + // dialog up), we may not be able display a prompt. In that case, default
|
| + // to denial.
|
| + if (!state->PromptUserForDownload(effective_tab, callback))
|
| + ScheduleNotification(callback, false);
|
| break;
|
|
|
| default:
|
|
|