Chromium Code Reviews| 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; |