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

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

Issue 164547: Mac: make save/open dialogs operate as tab-modal sheets.... Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Painfully (but hopefully correctly) merged ToT. Created 11 years, 2 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 | « chrome/browser/download/download_request_manager.h ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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:
« no previous file with comments | « chrome/browser/download/download_request_manager.h ('k') | chrome/browser/download/save_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698