Chromium Code Reviews| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 struct SHELL_DIALOGS_EXPORT FileTypeInfo { | 99 struct SHELL_DIALOGS_EXPORT FileTypeInfo { |
| 100 FileTypeInfo(); | 100 FileTypeInfo(); |
| 101 ~FileTypeInfo(); | 101 ~FileTypeInfo(); |
| 102 | 102 |
| 103 // A list of allowed extensions. For example, it might be | 103 // A list of allowed extensions. For example, it might be |
| 104 // | 104 // |
| 105 // { { "htm", "html" }, { "txt" } } | 105 // { { "htm", "html" }, { "txt" } } |
| 106 // | 106 // |
| 107 // Only pass more than one extension in the inner vector if the extensions | 107 // Only pass more than one extension in the inner vector if the extensions |
| 108 // are equivalent. Do NOT include leading periods. | 108 // are equivalent. Do NOT include leading periods. |
| 109 std::vector<std::vector<FilePath::StringType> > extensions; | 109 std::vector<std::vector<base::FilePath::StringType> > extensions; |
|
Mattias Nissler (ping if slow)
2013/02/06 17:53:33
unrelated changes?
Jói
2013/02/07 14:52:32
Yes, as in pref_member.h. Removed.
| |
| 110 | 110 |
| 111 // Overrides the system descriptions of the specified extensions. Entries | 111 // Overrides the system descriptions of the specified extensions. Entries |
| 112 // correspond to |extensions|; if left blank the system descriptions will | 112 // correspond to |extensions|; if left blank the system descriptions will |
| 113 // be used. | 113 // be used. |
| 114 std::vector<string16> extension_description_overrides; | 114 std::vector<string16> extension_description_overrides; |
| 115 | 115 |
| 116 // Specifies whether there will be a filter added for all files (i.e. *.*). | 116 // Specifies whether there will be a filter added for all files (i.e. *.*). |
| 117 bool include_all_files; | 117 bool include_all_files; |
| 118 | 118 |
| 119 // Specifies whether the caller can support files/folders that are on | 119 // Specifies whether the caller can support files/folders that are on |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 146 // modeless dialog. | 146 // modeless dialog. |
| 147 // |params| is data from the calling context which will be passed through to | 147 // |params| is data from the calling context which will be passed through to |
| 148 // the listener. Can be NULL. | 148 // the listener. Can be NULL. |
| 149 // NOTE: only one instance of any shell dialog can be shown per owning_window | 149 // NOTE: only one instance of any shell dialog can be shown per owning_window |
| 150 // at a time (for obvious reasons). | 150 // at a time (for obvious reasons). |
| 151 void SelectFile(Type type, | 151 void SelectFile(Type type, |
| 152 const string16& title, | 152 const string16& title, |
| 153 const FilePath& default_path, | 153 const FilePath& default_path, |
| 154 const FileTypeInfo* file_types, | 154 const FileTypeInfo* file_types, |
| 155 int file_type_index, | 155 int file_type_index, |
| 156 const FilePath::StringType& default_extension, | 156 const base::FilePath::StringType& default_extension, |
| 157 gfx::NativeWindow owning_window, | 157 gfx::NativeWindow owning_window, |
| 158 void* params); | 158 void* params); |
| 159 bool HasMultipleFileTypeChoices(); | 159 bool HasMultipleFileTypeChoices(); |
| 160 | 160 |
| 161 // Sets the global ShellDialogsDelegate. Defaults to NULL. | 161 // Sets the global ShellDialogsDelegate. Defaults to NULL. |
| 162 static void SetShellDialogsDelegate(ShellDialogsDelegate* delegate); | 162 static void SetShellDialogsDelegate(ShellDialogsDelegate* delegate); |
| 163 | 163 |
| 164 protected: | 164 protected: |
| 165 friend class base::RefCountedThreadSafe<SelectFileDialog>; | 165 friend class base::RefCountedThreadSafe<SelectFileDialog>; |
| 166 explicit SelectFileDialog(Listener* listener, | 166 explicit SelectFileDialog(Listener* listener, |
| 167 ui::SelectFilePolicy* policy); | 167 ui::SelectFilePolicy* policy); |
| 168 virtual ~SelectFileDialog(); | 168 virtual ~SelectFileDialog(); |
| 169 | 169 |
| 170 // Displays the actual file-selection dialog. | 170 // Displays the actual file-selection dialog. |
| 171 // This is overridden in the platform-specific descendants of FileSelectDialog | 171 // This is overridden in the platform-specific descendants of FileSelectDialog |
| 172 // and gets called from SelectFile after testing the | 172 // and gets called from SelectFile after testing the |
| 173 // AllowFileSelectionDialogs-Policy. | 173 // AllowFileSelectionDialogs-Policy. |
| 174 virtual void SelectFileImpl(Type type, | 174 virtual void SelectFileImpl( |
| 175 const string16& title, | 175 Type type, |
| 176 const FilePath& default_path, | 176 const string16& title, |
| 177 const FileTypeInfo* file_types, | 177 const FilePath& default_path, |
| 178 int file_type_index, | 178 const FileTypeInfo* file_types, |
| 179 const FilePath::StringType& default_extension, | 179 int file_type_index, |
| 180 gfx::NativeWindow owning_window, | 180 const base::FilePath::StringType& default_extension, |
| 181 void* params) = 0; | 181 gfx::NativeWindow owning_window, |
| 182 void* params) = 0; | |
| 182 | 183 |
| 183 // Returns the global ShellDialogsDelegate instance if any. | 184 // Returns the global ShellDialogsDelegate instance if any. |
| 184 ShellDialogsDelegate* GetShellDialogsDelegate(); | 185 ShellDialogsDelegate* GetShellDialogsDelegate(); |
| 185 | 186 |
| 186 // The listener to be notified of selection completion. | 187 // The listener to be notified of selection completion. |
| 187 Listener* listener_; | 188 Listener* listener_; |
| 188 | 189 |
| 189 private: | 190 private: |
| 190 // Tests if the file selection dialog can be displayed by | 191 // Tests if the file selection dialog can be displayed by |
| 191 // testing if the AllowFileSelectionDialogs-Policy is | 192 // testing if the AllowFileSelectionDialogs-Policy is |
| 192 // either unset or set to true. | 193 // either unset or set to true. |
| 193 bool CanOpenSelectFileDialog(); | 194 bool CanOpenSelectFileDialog(); |
| 194 | 195 |
| 195 // Informs the |listener_| that the file selection dialog was canceled. Moved | 196 // Informs the |listener_| that the file selection dialog was canceled. Moved |
| 196 // to a function for being able to post it to the message loop. | 197 // to a function for being able to post it to the message loop. |
| 197 void CancelFileSelection(void* params); | 198 void CancelFileSelection(void* params); |
| 198 | 199 |
| 199 // Returns true if the dialog has multiple file type choices. | 200 // Returns true if the dialog has multiple file type choices. |
| 200 virtual bool HasMultipleFileTypeChoicesImpl() = 0; | 201 virtual bool HasMultipleFileTypeChoicesImpl() = 0; |
| 201 | 202 |
| 202 scoped_ptr<ui::SelectFilePolicy> select_file_policy_; | 203 scoped_ptr<ui::SelectFilePolicy> select_file_policy_; |
| 203 | 204 |
| 204 DISALLOW_COPY_AND_ASSIGN(SelectFileDialog); | 205 DISALLOW_COPY_AND_ASSIGN(SelectFileDialog); |
| 205 }; | 206 }; |
| 206 | 207 |
| 207 } // namespace ui | 208 } // namespace ui |
| 208 | 209 |
| 209 #endif // UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ | 210 #endif // UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ |
| 210 | 211 |
| OLD | NEW |