OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ | 5 #ifndef UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ |
6 #define UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ | 6 #define UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 // NOTE: only one instance of any shell dialog can be shown per owning_window | 163 // NOTE: only one instance of any shell dialog can be shown per owning_window |
164 // at a time (for obvious reasons). | 164 // at a time (for obvious reasons). |
165 void SelectFile(Type type, | 165 void SelectFile(Type type, |
166 const base::string16& title, | 166 const base::string16& title, |
167 const base::FilePath& default_path, | 167 const base::FilePath& default_path, |
168 const FileTypeInfo* file_types, | 168 const FileTypeInfo* file_types, |
169 int file_type_index, | 169 int file_type_index, |
170 const base::FilePath::StringType& default_extension, | 170 const base::FilePath::StringType& default_extension, |
171 gfx::NativeWindow owning_window, | 171 gfx::NativeWindow owning_window, |
172 void* params); | 172 void* params); |
173 void Close(); | |
173 bool HasMultipleFileTypeChoices(); | 174 bool HasMultipleFileTypeChoices(); |
174 | 175 |
175 // Sets the global ShellDialogsDelegate. Defaults to NULL. | 176 // Sets the global ShellDialogsDelegate. Defaults to NULL. |
176 static void SetShellDialogsDelegate(ShellDialogsDelegate* delegate); | 177 static void SetShellDialogsDelegate(ShellDialogsDelegate* delegate); |
177 | 178 |
178 protected: | 179 protected: |
179 friend class base::RefCountedThreadSafe<SelectFileDialog>; | 180 friend class base::RefCountedThreadSafe<SelectFileDialog>; |
180 explicit SelectFileDialog(Listener* listener, SelectFilePolicy* policy); | 181 explicit SelectFileDialog(Listener* listener, SelectFilePolicy* policy); |
181 ~SelectFileDialog() override; | 182 ~SelectFileDialog() override; |
182 | 183 |
183 // Displays the actual file-selection dialog. | 184 // Displays the actual file-selection dialog. |
184 // This is overridden in the platform-specific descendants of FileSelectDialog | 185 // This is overridden in the platform-specific descendants of FileSelectDialog |
185 // and gets called from SelectFile after testing the | 186 // and gets called from SelectFile after testing the |
186 // AllowFileSelectionDialogs-Policy. | 187 // AllowFileSelectionDialogs-Policy. |
187 virtual void SelectFileImpl( | 188 virtual void SelectFileImpl( |
188 Type type, | 189 Type type, |
189 const base::string16& title, | 190 const base::string16& title, |
190 const base::FilePath& default_path, | 191 const base::FilePath& default_path, |
191 const FileTypeInfo* file_types, | 192 const FileTypeInfo* file_types, |
192 int file_type_index, | 193 int file_type_index, |
193 const base::FilePath::StringType& default_extension, | 194 const base::FilePath::StringType& default_extension, |
194 gfx::NativeWindow owning_window, | 195 gfx::NativeWindow owning_window, |
195 void* params) = 0; | 196 void* params) = 0; |
196 | 197 |
198 virtual void CloseImpl() = 0; | |
msw
2015/09/23 17:12:21
Give this base class a CloseImpl definition that j
| |
199 | |
197 // Returns the global ShellDialogsDelegate instance if any. | 200 // Returns the global ShellDialogsDelegate instance if any. |
198 ShellDialogsDelegate* GetShellDialogsDelegate(); | 201 ShellDialogsDelegate* GetShellDialogsDelegate(); |
199 | 202 |
200 // The listener to be notified of selection completion. | 203 // The listener to be notified of selection completion. |
201 Listener* listener_; | 204 Listener* listener_; |
202 | 205 |
203 private: | 206 private: |
204 // Tests if the file selection dialog can be displayed by | 207 // Tests if the file selection dialog can be displayed by |
205 // testing if the AllowFileSelectionDialogs-Policy is | 208 // testing if the AllowFileSelectionDialogs-Policy is |
206 // either unset or set to true. | 209 // either unset or set to true. |
207 bool CanOpenSelectFileDialog(); | 210 bool CanOpenSelectFileDialog(); |
208 | 211 |
209 // Informs the |listener_| that the file selection dialog was canceled. Moved | 212 // Informs the |listener_| that the file selection dialog was canceled. Moved |
210 // to a function for being able to post it to the message loop. | 213 // to a function for being able to post it to the message loop. |
211 void CancelFileSelection(void* params); | 214 void CancelFileSelection(void* params); |
212 | 215 |
213 // Returns true if the dialog has multiple file type choices. | 216 // Returns true if the dialog has multiple file type choices. |
214 virtual bool HasMultipleFileTypeChoicesImpl() = 0; | 217 virtual bool HasMultipleFileTypeChoicesImpl() = 0; |
215 | 218 |
216 scoped_ptr<SelectFilePolicy> select_file_policy_; | 219 scoped_ptr<SelectFilePolicy> select_file_policy_; |
217 | 220 |
218 DISALLOW_COPY_AND_ASSIGN(SelectFileDialog); | 221 DISALLOW_COPY_AND_ASSIGN(SelectFileDialog); |
219 }; | 222 }; |
220 | 223 |
221 } // namespace ui | 224 } // namespace ui |
222 | 225 |
223 #endif // UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ | 226 #endif // UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ |
OLD | NEW |