| 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 "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/gfx/native_widget_types.h" | 12 #include "base/gfx/native_widget_types.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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // NOTE: only one instance of any shell dialog can be shown per owning_window | 116 // NOTE: only one instance of any shell dialog can be shown per owning_window |
| 111 // at a time (for obvious reasons). | 117 // at a time (for obvious reasons). |
| 112 virtual void SelectFile(Type type, | 118 virtual void SelectFile(Type type, |
| 113 const string16& title, | 119 const string16& title, |
| 114 const FilePath& default_path, | 120 const FilePath& default_path, |
| 115 const FileTypeInfo* file_types, | 121 const FileTypeInfo* file_types, |
| 116 int file_type_index, | 122 int file_type_index, |
| 117 const FilePath::StringType& default_extension, | 123 const FilePath::StringType& default_extension, |
| 118 gfx::NativeWindow owning_window, | 124 gfx::NativeWindow owning_window, |
| 119 void* params) = 0; | 125 void* params) = 0; |
| 126 |
| 127 // Same as SelectFile(), with nearly identical arguments, except that -- on |
| 128 // platforms where this is supported -- it will display a tab-modal dialog box |
| 129 // for the tab specified by |owning_tab| (if it is NULL, this will yield a |
| 130 // modeless dialog). More than one instance can be shown per window. |
| 131 virtual void SelectFileInTab(Type type, |
| 132 const string16& title, |
| 133 const FilePath& default_path, |
| 134 const FileTypeInfo* file_types, |
| 135 int file_type_index, |
| 136 const FilePath::StringType& default_extension, |
| 137 TabContents* owning_tab, |
| 138 void* params) = 0; |
| 120 }; | 139 }; |
| 121 | 140 |
| 122 // Shows a dialog box for selecting a font. | 141 // Shows a dialog box for selecting a font. |
| 123 class SelectFontDialog | 142 class SelectFontDialog |
| 124 : public base::RefCountedThreadSafe<SelectFileDialog>, | 143 : public base::RefCountedThreadSafe<SelectFileDialog>, |
| 125 public BaseShellDialog { | 144 public BaseShellDialog { |
| 126 public: | 145 public: |
| 127 virtual ~SelectFontDialog() {} | 146 virtual ~SelectFontDialog() {} |
| 128 | 147 |
| 129 // An interface implemented by a Listener object wishing to know about the | 148 // An interface implemented by a Listener object wishing to know about the |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 | 182 |
| 164 // Same as above - also support specifying the default font selected in the | 183 // Same as above - also support specifying the default font selected in the |
| 165 // list when the dialog appears. | 184 // list when the dialog appears. |
| 166 virtual void SelectFont(gfx::NativeWindow owning_window, | 185 virtual void SelectFont(gfx::NativeWindow owning_window, |
| 167 void* params, | 186 void* params, |
| 168 const std::wstring& font_name, | 187 const std::wstring& font_name, |
| 169 int font_size) = 0; | 188 int font_size) = 0; |
| 170 }; | 189 }; |
| 171 | 190 |
| 172 #endif // CHROME_BROWSER_SHELL_DIALOGS_H_ | 191 #endif // CHROME_BROWSER_SHELL_DIALOGS_H_ |
| OLD | NEW |