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_SELECT_FILE_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_ |
6 #define CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
| 15 #include "chrome/browser/ui/base_shell_dialog.h" |
15 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 class WebContents; | 19 class WebContents; |
19 struct SelectedFileInfo; | 20 struct SelectedFileInfo; |
20 } | 21 } |
21 | 22 |
22 // This function is declared extern such that it is accessible for unit tests | 23 // This function is declared extern such that it is accessible for unit tests |
23 // in /chrome/browser/ui/views/select_file_dialog_win_unittest.cc | 24 // in /chrome/browser/ui/views/select_file_dialog_win_unittest.cc |
24 extern std::wstring AppendExtensionIfNeeded(const std::wstring& filename, | 25 extern std::wstring AppendExtensionIfNeeded(const std::wstring& filename, |
25 const std::wstring& filter_selected, | 26 const std::wstring& filter_selected, |
26 const std::wstring& suggested_ext); | 27 const std::wstring& suggested_ext); |
27 | 28 |
28 // A base class for shell dialogs. | |
29 class BaseShellDialog { | |
30 public: | |
31 // Returns true if a shell dialog box is currently being shown modally | |
32 // to the specified owner. | |
33 virtual bool IsRunning(gfx::NativeWindow owning_window) const = 0; | |
34 | |
35 // Notifies the dialog box that the listener has been destroyed and it should | |
36 // no longer be sent notifications. | |
37 virtual void ListenerDestroyed() = 0; | |
38 | |
39 protected: | |
40 virtual ~BaseShellDialog() {} | |
41 }; | |
42 | |
43 // Shows a dialog box for selecting a file or a folder. | 29 // Shows a dialog box for selecting a file or a folder. |
44 class SelectFileDialog | 30 class SelectFileDialog |
45 : public base::RefCountedThreadSafe<SelectFileDialog>, | 31 : public base::RefCountedThreadSafe<SelectFileDialog>, |
46 public BaseShellDialog { | 32 public BaseShellDialog { |
47 public: | 33 public: |
48 enum Type { | 34 enum Type { |
49 SELECT_NONE, | 35 SELECT_NONE, |
50 SELECT_FOLDER, | 36 SELECT_FOLDER, |
51 SELECT_SAVEAS_FILE, | 37 SELECT_SAVEAS_FILE, |
52 SELECT_OPEN_FILE, | 38 SELECT_OPEN_FILE, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 175 |
190 // Informs the |listener_| that the file selection dialog was canceled. Moved | 176 // Informs the |listener_| that the file selection dialog was canceled. Moved |
191 // to a function for being able to post it to the message loop. | 177 // to a function for being able to post it to the message loop. |
192 void CancelFileSelection(void* params); | 178 void CancelFileSelection(void* params); |
193 | 179 |
194 // Returns true if the dialog has multiple file type choices. | 180 // Returns true if the dialog has multiple file type choices. |
195 virtual bool HasMultipleFileTypeChoicesImpl() = 0; | 181 virtual bool HasMultipleFileTypeChoicesImpl() = 0; |
196 }; | 182 }; |
197 | 183 |
198 #endif // CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_ | 184 #endif // CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_ |
OLD | NEW |