| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/logging.h" | 5 #include "base/logging.h" |
| 6 #include "chrome/browser/extensions/extension_file_browser_private_api.h" | 6 #include "chrome/browser/extensions/extension_file_browser_private_api.h" |
| 7 #include "chrome/browser/extensions/file_manager_util.h" | 7 #include "chrome/browser/extensions/file_manager_util.h" |
| 8 #include "chrome/browser/profiles/profile_manager.h" | 8 #include "chrome/browser/profiles/profile_manager.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_dialogs.h" | 10 #include "chrome/browser/ui/browser_dialogs.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 return owner_window_ == owner_window; | 79 return owner_window_ == owner_window; |
| 80 } | 80 } |
| 81 | 81 |
| 82 void FileManagerDialog::ListenerDestroyed() { | 82 void FileManagerDialog::ListenerDestroyed() { |
| 83 listener_ = NULL; | 83 listener_ = NULL; |
| 84 FileDialogFunction::Callback::Remove(tab_id_); | 84 FileDialogFunction::Callback::Remove(tab_id_); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void FileManagerDialog::ExtensionDialogIsClosing(ExtensionDialog* dialog) { | 87 void FileManagerDialog::ExtensionDialogIsClosing(ExtensionDialog* dialog) { |
| 88 owner_window_ = NULL; | 88 owner_window_ = NULL; |
| 89 FileDialogFunction::Callback::Remove(tab_id_); |
| 89 } | 90 } |
| 90 | 91 |
| 91 void FileManagerDialog::SelectFileImpl( | 92 void FileManagerDialog::SelectFileImpl( |
| 92 Type type, | 93 Type type, |
| 93 const string16& title, | 94 const string16& title, |
| 94 const FilePath& default_path, | 95 const FilePath& default_path, |
| 95 const FileTypeInfo* file_types, | 96 const FileTypeInfo* file_types, |
| 96 int file_type_index, | 97 int file_type_index, |
| 97 const FilePath::StringType& default_extension, | 98 const FilePath::StringType& default_extension, |
| 98 gfx::NativeWindow owner_window, | 99 gfx::NativeWindow owner_window, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 114 | 115 |
| 115 // Connect our listener to FileDialogFunction's per-tab callbacks. | 116 // Connect our listener to FileDialogFunction's per-tab callbacks. |
| 116 Browser* extension_browser = dialog->host()->view()->browser(); | 117 Browser* extension_browser = dialog->host()->view()->browser(); |
| 117 TabContents* contents = extension_browser->GetSelectedTabContents(); | 118 TabContents* contents = extension_browser->GetSelectedTabContents(); |
| 118 int32 tab_id = (contents ? contents->controller().session_id().id() : 0); | 119 int32 tab_id = (contents ? contents->controller().session_id().id() : 0); |
| 119 FileDialogFunction::Callback::Add(tab_id, listener_, params); | 120 FileDialogFunction::Callback::Add(tab_id, listener_, params); |
| 120 | 121 |
| 121 tab_id_ = tab_id; | 122 tab_id_ = tab_id; |
| 122 owner_window_ = owner_window; | 123 owner_window_ = owner_window; |
| 123 } | 124 } |
| OLD | NEW |