Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: ui/shell_dialogs/select_file_dialog.h

Issue 12217101: Replace FilePath with base::FilePath in some more top level directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 29 matching lines...) Expand all
40 40
41 // An interface implemented by a Listener object wishing to know about the 41 // An interface implemented by a Listener object wishing to know about the
42 // the result of the Select File/Folder action. These callbacks must be 42 // the result of the Select File/Folder action. These callbacks must be
43 // re-entrant. 43 // re-entrant.
44 class SHELL_DIALOGS_EXPORT Listener { 44 class SHELL_DIALOGS_EXPORT Listener {
45 public: 45 public:
46 // Notifies the Listener that a file/folder selection has been made. The 46 // Notifies the Listener that a file/folder selection has been made. The
47 // file/folder path is in |path|. |params| is contextual passed to 47 // file/folder path is in |path|. |params| is contextual passed to
48 // SelectFile. |index| specifies the index of the filter passed to the 48 // SelectFile. |index| specifies the index of the filter passed to the
49 // the initial call to SelectFile. 49 // the initial call to SelectFile.
50 virtual void FileSelected(const FilePath& path, 50 virtual void FileSelected(const base::FilePath& path,
51 int index, void* params) = 0; 51 int index, void* params) = 0;
52 52
53 // Similar to FileSelected() but takes SelectedFileInfo instead of 53 // Similar to FileSelected() but takes SelectedFileInfo instead of
54 // FilePath. Used for passing extra information (ex. display name). 54 // base::FilePath. Used for passing extra information (ex. display name).
55 // 55 //
56 // If not overridden, calls FileSelected() with path from |file|. 56 // If not overridden, calls FileSelected() with path from |file|.
57 virtual void FileSelectedWithExtraInfo( 57 virtual void FileSelectedWithExtraInfo(
58 const ui::SelectedFileInfo& file, 58 const ui::SelectedFileInfo& file,
59 int index, 59 int index,
60 void* params); 60 void* params);
61 61
62 // Notifies the Listener that many files have been selected. The 62 // Notifies the Listener that many files have been selected. The
63 // files are in |files|. |params| is contextual passed to SelectFile. 63 // files are in |files|. |params| is contextual passed to SelectFile.
64 virtual void MultiFilesSelected( 64 virtual void MultiFilesSelected(
65 const std::vector<FilePath>& files, void* params) {} 65 const std::vector<base::FilePath>& files, void* params) {}
66 66
67 // Similar to MultiFilesSelected() but takes SelectedFileInfo instead of 67 // Similar to MultiFilesSelected() but takes SelectedFileInfo instead of
68 // FilePath. Used for passing extra information (ex. display name). 68 // base::FilePath. Used for passing extra information (ex. display name).
69 // 69 //
70 // If not overridden, calls MultiFilesSelected() with paths from |files|. 70 // If not overridden, calls MultiFilesSelected() with paths from |files|.
71 virtual void MultiFilesSelectedWithExtraInfo( 71 virtual void MultiFilesSelectedWithExtraInfo(
72 const std::vector<ui::SelectedFileInfo>& files, 72 const std::vector<ui::SelectedFileInfo>& files,
73 void* params); 73 void* params);
74 74
75 // Notifies the Listener that the file/folder selection was aborted (via 75 // Notifies the Listener that the file/folder selection was aborted (via
76 // the user canceling or closing the selection dialog box, for example). 76 // the user canceling or closing the selection dialog box, for example).
77 // |params| is contextual passed to SelectFile. 77 // |params| is contextual passed to SelectFile.
78 virtual void FileSelectionCanceled(void* params) {} 78 virtual void FileSelectionCanceled(void* params) {}
(...skipping 20 matching lines...) Expand all
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;
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 Drive. 119 // Specifies whether the caller can support files/folders that are on Drive.
(...skipping 22 matching lines...) Expand all
142 // user doesn't type one. This should NOT include the '.'. On Windows, if 142 // user doesn't type one. This should NOT include the '.'. On Windows, if
143 // you specify this you must also specify |file_types|. 143 // you specify this you must also specify |file_types|.
144 // |owning_window| is the window the dialog is modal to, or NULL for a 144 // |owning_window| is the window the dialog is modal to, or NULL for a
145 // modeless dialog. 145 // modeless dialog.
146 // |params| is data from the calling context which will be passed through to 146 // |params| is data from the calling context which will be passed through to
147 // the listener. Can be NULL. 147 // the listener. Can be NULL.
148 // NOTE: only one instance of any shell dialog can be shown per owning_window 148 // NOTE: only one instance of any shell dialog can be shown per owning_window
149 // at a time (for obvious reasons). 149 // at a time (for obvious reasons).
150 void SelectFile(Type type, 150 void SelectFile(Type type,
151 const string16& title, 151 const string16& title,
152 const FilePath& default_path, 152 const base::FilePath& default_path,
153 const FileTypeInfo* file_types, 153 const FileTypeInfo* file_types,
154 int file_type_index, 154 int file_type_index,
155 const FilePath::StringType& default_extension, 155 const base::FilePath::StringType& default_extension,
156 gfx::NativeWindow owning_window, 156 gfx::NativeWindow owning_window,
157 void* params); 157 void* params);
158 bool HasMultipleFileTypeChoices(); 158 bool HasMultipleFileTypeChoices();
159 159
160 // Sets the global ShellDialogsDelegate. Defaults to NULL. 160 // Sets the global ShellDialogsDelegate. Defaults to NULL.
161 static void SetShellDialogsDelegate(ShellDialogsDelegate* delegate); 161 static void SetShellDialogsDelegate(ShellDialogsDelegate* delegate);
162 162
163 protected: 163 protected:
164 friend class base::RefCountedThreadSafe<SelectFileDialog>; 164 friend class base::RefCountedThreadSafe<SelectFileDialog>;
165 explicit SelectFileDialog(Listener* listener, 165 explicit SelectFileDialog(Listener* listener,
166 ui::SelectFilePolicy* policy); 166 ui::SelectFilePolicy* policy);
167 virtual ~SelectFileDialog(); 167 virtual ~SelectFileDialog();
168 168
169 // Displays the actual file-selection dialog. 169 // Displays the actual file-selection dialog.
170 // This is overridden in the platform-specific descendants of FileSelectDialog 170 // This is overridden in the platform-specific descendants of FileSelectDialog
171 // and gets called from SelectFile after testing the 171 // and gets called from SelectFile after testing the
172 // AllowFileSelectionDialogs-Policy. 172 // AllowFileSelectionDialogs-Policy.
173 virtual void SelectFileImpl(Type type, 173 virtual void SelectFileImpl(
174 const string16& title, 174 Type type,
175 const FilePath& default_path, 175 const string16& title,
176 const FileTypeInfo* file_types, 176 const base::FilePath& default_path,
177 int file_type_index, 177 const FileTypeInfo* file_types,
178 const FilePath::StringType& default_extension, 178 int file_type_index,
179 gfx::NativeWindow owning_window, 179 const base::FilePath::StringType& default_extension,
180 void* params) = 0; 180 gfx::NativeWindow owning_window,
181 void* params) = 0;
181 182
182 // Returns the global ShellDialogsDelegate instance if any. 183 // Returns the global ShellDialogsDelegate instance if any.
183 ShellDialogsDelegate* GetShellDialogsDelegate(); 184 ShellDialogsDelegate* GetShellDialogsDelegate();
184 185
185 // The listener to be notified of selection completion. 186 // The listener to be notified of selection completion.
186 Listener* listener_; 187 Listener* listener_;
187 188
188 private: 189 private:
189 // Tests if the file selection dialog can be displayed by 190 // Tests if the file selection dialog can be displayed by
190 // testing if the AllowFileSelectionDialogs-Policy is 191 // testing if the AllowFileSelectionDialogs-Policy is
191 // either unset or set to true. 192 // either unset or set to true.
192 bool CanOpenSelectFileDialog(); 193 bool CanOpenSelectFileDialog();
193 194
194 // Informs the |listener_| that the file selection dialog was canceled. Moved 195 // Informs the |listener_| that the file selection dialog was canceled. Moved
195 // to a function for being able to post it to the message loop. 196 // to a function for being able to post it to the message loop.
196 void CancelFileSelection(void* params); 197 void CancelFileSelection(void* params);
197 198
198 // Returns true if the dialog has multiple file type choices. 199 // Returns true if the dialog has multiple file type choices.
199 virtual bool HasMultipleFileTypeChoicesImpl() = 0; 200 virtual bool HasMultipleFileTypeChoicesImpl() = 0;
200 201
201 scoped_ptr<ui::SelectFilePolicy> select_file_policy_; 202 scoped_ptr<ui::SelectFilePolicy> select_file_policy_;
202 203
203 DISALLOW_COPY_AND_ASSIGN(SelectFileDialog); 204 DISALLOW_COPY_AND_ASSIGN(SelectFileDialog);
204 }; 205 };
205 206
206 } // namespace ui 207 } // namespace ui
207 208
208 #endif // UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_ 209 #endif // UI_SHELL_DIALOGS_SELECT_FILE_DIALOG_H_
209 210
OLDNEW
« no previous file with comments | « ui/shell_dialogs/gtk/select_file_dialog_impl_kde.cc ('k') | ui/shell_dialogs/select_file_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698