| OLD | NEW |
| 1 // Copyright (c) 2011 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 } | 20 } |
| 20 | 21 |
| 21 // This function is declared extern such that it is accessible for unit tests | 22 // This function is declared extern such that it is accessible for unit tests |
| 22 // in /chrome/browser/ui/views/select_file_dialog_win_unittest.cc | 23 // in /chrome/browser/ui/views/select_file_dialog_win_unittest.cc |
| 23 extern std::wstring AppendExtensionIfNeeded(const std::wstring& filename, | 24 extern std::wstring AppendExtensionIfNeeded(const std::wstring& filename, |
| 24 const std::wstring& filter_selected, | 25 const std::wstring& filter_selected, |
| 25 const std::wstring& suggested_ext); | 26 const std::wstring& suggested_ext); |
| 26 | 27 |
| 27 // A base class for shell dialogs. | |
| 28 class BaseShellDialog { | |
| 29 public: | |
| 30 // Returns true if a shell dialog box is currently being shown modally | |
| 31 // to the specified owner. | |
| 32 virtual bool IsRunning(gfx::NativeWindow owning_window) const = 0; | |
| 33 | |
| 34 // Notifies the dialog box that the listener has been destroyed and it should | |
| 35 // no longer be sent notifications. | |
| 36 virtual void ListenerDestroyed() = 0; | |
| 37 | |
| 38 protected: | |
| 39 virtual ~BaseShellDialog() {} | |
| 40 }; | |
| 41 | |
| 42 // Shows a dialog box for selecting a file or a folder. | 28 // Shows a dialog box for selecting a file or a folder. |
| 43 class SelectFileDialog | 29 class SelectFileDialog |
| 44 : public base::RefCountedThreadSafe<SelectFileDialog>, | 30 : public base::RefCountedThreadSafe<SelectFileDialog>, |
| 45 public BaseShellDialog { | 31 public BaseShellDialog { |
| 46 public: | 32 public: |
| 47 enum Type { | 33 enum Type { |
| 48 SELECT_NONE, | 34 SELECT_NONE, |
| 49 SELECT_FOLDER, | 35 SELECT_FOLDER, |
| 50 SELECT_SAVEAS_FILE, | 36 SELECT_SAVEAS_FILE, |
| 51 SELECT_OPEN_FILE, | 37 SELECT_OPEN_FILE, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 157 |
| 172 // Informs the |listener_| that the file selection dialog was canceled. Moved | 158 // Informs the |listener_| that the file selection dialog was canceled. Moved |
| 173 // to a function for being able to post it to the message loop. | 159 // to a function for being able to post it to the message loop. |
| 174 void CancelFileSelection(void* params); | 160 void CancelFileSelection(void* params); |
| 175 | 161 |
| 176 // Returns true if the dialog has multiple file type choices. | 162 // Returns true if the dialog has multiple file type choices. |
| 177 virtual bool HasMultipleFileTypeChoicesImpl() = 0; | 163 virtual bool HasMultipleFileTypeChoicesImpl() = 0; |
| 178 }; | 164 }; |
| 179 | 165 |
| 180 #endif // CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_ | 166 #endif // CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_ |
| OLD | NEW |