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

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: space 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..49e2e5dc0e7ecf3f4a070ebf800f1e82d7ff48e6 100644
--- a/chrome/browser/ui/views/file_manager_dialog.cc
+++ b/chrome/browser/ui/views/file_manager_dialog.cc
@@ -172,6 +172,11 @@ void FileManagerDialog::AddPending(int32 tab_id) {
PendingDialog::GetInstance()->Add(tab_id, this);
}
+// static
+bool FileManagerDialog::PendingExists(int32 tab_id) {
+ return PendingDialog::GetInstance()->Find(tab_id) != NULL;
+}
+
bool FileManagerDialog::HasMultipleFileTypeChoicesImpl() {
return hasMultipleFileTypeChoices_;
}
@@ -198,6 +203,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;
+ if (PendingExists(tab_id))
+ return;
+
FilePath virtual_path;
if (!FileManagerUtil::ConvertFileToRelativeFileSystemPath(
owner_browser->profile(), default_path, &virtual_path)) {
@@ -210,7 +223,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 +234,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;
« no previous file with comments | « chrome/browser/ui/views/file_manager_dialog.h ('k') | chrome/browser/ui/views/file_manager_dialog_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698