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

Unified Diff: chrome/browser/ui/views/file_manager_dialog.cc

Issue 8523006: Don't show FileManagerDialog if another FileManagerDialog is shown in the same tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: a naming nit Created 9 years, 1 month 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/ui/views/file_manager_dialog.cc
diff --git a/chrome/browser/ui/views/file_manager_dialog.cc b/chrome/browser/ui/views/file_manager_dialog.cc
index 7e2aa5714c52b8c2ce764f0993e3ff61e3853ae8..b9053ed18465a47e3fce880212e7958fd73a6309 100644
--- a/chrome/browser/ui/views/file_manager_dialog.cc
+++ b/chrome/browser/ui/views/file_manager_dialog.cc
@@ -172,6 +172,10 @@ void FileManagerDialog::AddPending(int32 tab_id) {
PendingDialog::GetInstance()->Add(tab_id, this);
}
+bool FileManagerDialog::PendingExists(int32 tab_id) {
+ return PendingDialog::GetInstance()->Find(tab_id) != NULL;
+}
+
bool FileManagerDialog::HasMultipleFileTypeChoicesImpl() {
return hasMultipleFileTypeChoices_;
}
@@ -198,6 +202,14 @@ void FileManagerDialog::SelectFileImpl(
return;
}
+ TabContentsWrapper* tab = owner_browser->GetSelectedTabContentsWrapper();
+
+ // Check if we have another dialog opened in the tab. It's unlikely, but
+ // possible.
+ int32 tab_id = (tab ? tab->restore_tab_helper()->session_id().id() : 0);
achuithb 2011/11/10 20:58:40 parens are not required.
tbarzic 2011/11/10 22:00:48 removed
+ if (PendingExists(tab_id))
+ return;
+
FilePath virtual_path;
if (!FileManagerUtil::ConvertFileToRelativeFileSystemPath(
owner_browser->profile(), default_path, &virtual_path)) {
@@ -210,7 +222,7 @@ void FileManagerDialog::SelectFileImpl(
GURL file_browser_url = FileManagerUtil::GetFileBrowserUrlWithParams(
type, title, virtual_path, file_types, file_type_index,
default_extension);
- TabContentsWrapper* tab = owner_browser->GetSelectedTabContentsWrapper();
+
ExtensionDialog* dialog = ExtensionDialog::Show(file_browser_url,
owner_browser, tab->tab_contents(),
kFileManagerWidth, kFileManagerHeight,
@@ -221,7 +233,6 @@ void FileManagerDialog::SelectFileImpl(
}
// Connect our listener to FileDialogFunction's per-tab callbacks.
- int32 tab_id = (tab ? tab->restore_tab_helper()->session_id().id() : 0);
AddPending(tab_id);
extension_dialog_ = dialog;

Powered by Google App Engine
This is Rietveld 408576698