| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "chrome/browser/ui/select_file_dialog.h" | 13 #include "chrome/browser/ui/select_file_dialog.h" |
| 14 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" | 14 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" |
| 15 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow | 15 #include "ui/gfx/native_widget_types.h" // gfx::NativeWindow |
| 16 | 16 |
| 17 class Browser; | |
| 18 class ExtensionDialog; | 17 class ExtensionDialog; |
| 18 class Profile; |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 class RenderViewHost; | 21 class RenderViewHost; |
| 22 struct SelectedFileInfo; | 22 struct SelectedFileInfo; |
| 23 } | 23 } |
| 24 | 24 |
| 25 // Shows a dialog box for selecting a file or a folder, using the | 25 // Shows a dialog box for selecting a file or a folder, using the |
| 26 // file manager extension implementation. | 26 // file manager extension implementation. |
| 27 class SelectFileDialogExtension | 27 class SelectFileDialogExtension |
| 28 : public SelectFileDialog, | 28 : public SelectFileDialog, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 static bool PendingExists(int32 tab_id); | 82 static bool PendingExists(int32 tab_id); |
| 83 | 83 |
| 84 // Returns true if the dialog has multiple file type choices. | 84 // Returns true if the dialog has multiple file type choices. |
| 85 virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; | 85 virtual bool HasMultipleFileTypeChoicesImpl() OVERRIDE; |
| 86 | 86 |
| 87 bool has_multiple_file_type_choices_; | 87 bool has_multiple_file_type_choices_; |
| 88 | 88 |
| 89 // Host for the extension that implements this dialog. | 89 // Host for the extension that implements this dialog. |
| 90 scoped_refptr<ExtensionDialog> extension_dialog_; | 90 scoped_refptr<ExtensionDialog> extension_dialog_; |
| 91 | 91 |
| 92 // ID of the tab that spawned this dialog, used to route callbacks. | 92 // ID of the tab that spawned this dialog, used to route callbacks. If the |
| 93 // dialog is not associated with any browser it will be shown full screen, |
| 94 // with the tab_id set to 0. |
| 93 int32 tab_id_; | 95 int32 tab_id_; |
| 94 | 96 |
| 95 // Cache a pointer to our owner browser. Since we're a child window of our | 97 // Pointer to the profile the dialog is running in. |
| 96 // owner browser, if this browser gets deleted, it will also close us. | 98 Profile* profile_; |
| 97 Browser* owner_browser_; | |
| 98 | 99 |
| 100 // The window that created the dialog. |
| 99 gfx::NativeWindow owner_window_; | 101 gfx::NativeWindow owner_window_; |
| 100 | 102 |
| 101 // We defer the callback into SelectFileDialog::Listener until the window | 103 // We defer the callback into SelectFileDialog::Listener until the window |
| 102 // closes, to match the semantics of file selection on Windows and Mac. | 104 // closes, to match the semantics of file selection on Windows and Mac. |
| 103 // These are the data passed to the listener. | 105 // These are the data passed to the listener. |
| 104 enum SelectionType { | 106 enum SelectionType { |
| 105 CANCEL = 0, | 107 CANCEL = 0, |
| 106 SINGLE_FILE, | 108 SINGLE_FILE, |
| 107 MULTIPLE_FILES | 109 MULTIPLE_FILES |
| 108 }; | 110 }; |
| 109 SelectionType selection_type_; | 111 SelectionType selection_type_; |
| 110 std::vector<content::SelectedFileInfo> selection_files_; | 112 std::vector<content::SelectedFileInfo> selection_files_; |
| 111 int selection_index_; | 113 int selection_index_; |
| 112 void* params_; | 114 void* params_; |
| 113 | 115 |
| 114 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogExtension); | 116 DISALLOW_COPY_AND_ASSIGN(SelectFileDialogExtension); |
| 115 }; | 117 }; |
| 116 | 118 |
| 117 #endif // CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ | 119 #endif // CHROME_BROWSER_UI_VIEWS_SELECT_FILE_DIALOG_EXTENSION_H_ |
| OLD | NEW |