| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_SHELL_DIALOGS_H_ | 5 #ifndef CHROME_BROWSER_SHELL_DIALOGS_H_ |
| 6 #define CHROME_BROWSER_SHELL_DIALOGS_H_ | 6 #define CHROME_BROWSER_SHELL_DIALOGS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "app/gfx/native_widget_types.h" | 11 #include "app/gfx/native_widget_types.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
| 14 #include "base/string16.h" | 14 #include "base/string16.h" |
| 15 | 15 |
| 16 class TabContents; |
| 17 |
| 16 namespace gfx { | 18 namespace gfx { |
| 17 class Font; | 19 class Font; |
| 18 } | 20 } |
| 19 | 21 |
| 20 // A base class for shell dialogs. | 22 // A base class for shell dialogs. |
| 21 class BaseShellDialog { | 23 class BaseShellDialog { |
| 22 public: | 24 public: |
| 23 // Returns true if a shell dialog box is currently being shown modally | 25 // Returns true if a shell dialog box is currently being shown modally |
| 24 // to the specified owner. | 26 // to the specified owner. (For tab-modals, one should provide a default |
| 27 // implementations which just produces a window-modal; hence our default |
| 28 // implementation just returns false.) |
| 25 virtual bool IsRunning(gfx::NativeWindow owning_window) const = 0; | 29 virtual bool IsRunning(gfx::NativeWindow owning_window) const = 0; |
| 30 virtual bool IsRunningInTab(const TabContents* parent_tab) const |
| 31 { return false; } |
| 26 | 32 |
| 27 // Notifies the dialog box that the listener has been destroyed and it should | 33 // Notifies the dialog box that the listener has been destroyed and it should |
| 28 // no longer be sent notifications. | 34 // no longer be sent notifications. |
| 29 virtual void ListenerDestroyed() = 0; | 35 virtual void ListenerDestroyed() = 0; |
| 30 }; | 36 }; |
| 31 | 37 |
| 32 // Shows a dialog box for selecting a file or a folder. | 38 // Shows a dialog box for selecting a file or a folder. |
| 33 class SelectFileDialog | 39 class SelectFileDialog |
| 34 : public base::RefCountedThreadSafe<SelectFileDialog>, | 40 : public base::RefCountedThreadSafe<SelectFileDialog>, |
| 35 public BaseShellDialog { | 41 public BaseShellDialog { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // at a time (for obvious reasons). | 115 // at a time (for obvious reasons). |
| 110 virtual void SelectFile(Type type, | 116 virtual void SelectFile(Type type, |
| 111 const string16& title, | 117 const string16& title, |
| 112 const FilePath& default_path, | 118 const FilePath& default_path, |
| 113 const FileTypeInfo* file_types, | 119 const FileTypeInfo* file_types, |
| 114 int file_type_index, | 120 int file_type_index, |
| 115 const FilePath::StringType& default_extension, | 121 const FilePath::StringType& default_extension, |
| 116 gfx::NativeWindow owning_window, | 122 gfx::NativeWindow owning_window, |
| 117 void* params) = 0; | 123 void* params) = 0; |
| 118 | 124 |
| 125 // Same as SelectFile(), with nearly identical arguments, except that -- on |
| 126 // platforms where this is supported -- it will display a tab-modal dialog box |
| 127 // for the tab specified by |owning_tab| (if it is NULL, this will yield a |
| 128 // modeless dialog). More than one instance can be shown per window. |
| 129 virtual void SelectFileInTab(Type type, |
| 130 const string16& title, |
| 131 const FilePath& default_path, |
| 132 const FileTypeInfo* file_types, |
| 133 int file_type_index, |
| 134 const FilePath::StringType& default_extension, |
| 135 TabContents* owning_tab, |
| 136 void* params) = 0; |
| 137 |
| 119 protected: | 138 protected: |
| 120 friend class base::RefCountedThreadSafe<SelectFileDialog>; | 139 friend class base::RefCountedThreadSafe<SelectFileDialog>; |
| 121 | 140 |
| 122 virtual ~SelectFileDialog() {} | 141 virtual ~SelectFileDialog() {} |
| 123 }; | 142 }; |
| 124 | 143 |
| 125 // Shows a dialog box for selecting a font. | 144 // Shows a dialog box for selecting a font. |
| 126 class SelectFontDialog | 145 class SelectFontDialog |
| 127 : public base::RefCountedThreadSafe<SelectFontDialog>, | 146 : public base::RefCountedThreadSafe<SelectFontDialog>, |
| 128 public BaseShellDialog { | 147 public BaseShellDialog { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 const std::wstring& font_name, | 189 const std::wstring& font_name, |
| 171 int font_size) = 0; | 190 int font_size) = 0; |
| 172 | 191 |
| 173 protected: | 192 protected: |
| 174 friend class base::RefCountedThreadSafe<SelectFontDialog>; | 193 friend class base::RefCountedThreadSafe<SelectFontDialog>; |
| 175 | 194 |
| 176 virtual ~SelectFontDialog() {} | 195 virtual ~SelectFontDialog() {} |
| 177 }; | 196 }; |
| 178 | 197 |
| 179 #endif // CHROME_BROWSER_SHELL_DIALOGS_H_ | 198 #endif // CHROME_BROWSER_SHELL_DIALOGS_H_ |
| OLD | NEW |