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

Side by Side Diff: chrome/browser/ui/select_file_dialog.h

Issue 10698053: Breaks compile on Linux Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_UI_SELECT_FILE_DIALOG_H_ 5 #ifndef CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_
6 #define CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_ 6 #define CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/basictypes.h"
13 #include "base/callback_forward.h"
14 #include "base/file_path.h" 12 #include "base/file_path.h"
15 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/string16.h" 14 #include "base/string16.h"
18 #include "ui/base/dialogs/base_shell_dialog.h" 15 #include "ui/base/dialogs/base_shell_dialog.h"
19 #include "ui/gfx/native_widget_types.h" 16 #include "ui/gfx/native_widget_types.h"
20 17
21 namespace ui {
22 class SelectFilePolicy;
23 }
24
25 namespace content { 18 namespace content {
26 class WebContents; 19 class WebContents;
27 } 20 }
28 21
29 namespace ui { 22 namespace ui {
30 struct SelectedFileInfo; 23 struct SelectedFileInfo;
31 } 24 }
32 25
33 // This function is declared extern such that it is accessible for unit tests 26 // This function is declared extern such that it is accessible for unit tests
34 // in /chrome/browser/ui/views/select_file_dialog_win_unittest.cc 27 // in /chrome/browser/ui/views/select_file_dialog_win_unittest.cc
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // Notifies the Listener that the file/folder selection was aborted (via 79 // Notifies the Listener that the file/folder selection was aborted (via
87 // the user canceling or closing the selection dialog box, for example). 80 // the user canceling or closing the selection dialog box, for example).
88 // |params| is contextual passed to SelectFile. 81 // |params| is contextual passed to SelectFile.
89 virtual void FileSelectionCanceled(void* params) {} 82 virtual void FileSelectionCanceled(void* params) {}
90 83
91 protected: 84 protected:
92 virtual ~Listener() {} 85 virtual ~Listener() {}
93 }; 86 };
94 87
95 // Creates a dialog box helper. This object is ref-counted, but the returned 88 // Creates a dialog box helper. This object is ref-counted, but the returned
96 // object will have no reference (refcount is 0). |policy| is an optional 89 // object will have no reference (refcount is 0).
97 // class that can prevent showing a dialog. 90 static SelectFileDialog* Create(Listener* listener);
98 static SelectFileDialog* Create(Listener* listener,
99 ui::SelectFilePolicy* policy);
100 91
101 // Holds information about allowed extensions on a file save dialog. 92 // Holds information about allowed extensions on a file save dialog.
102 // |extensions| is a list of allowed extensions. For example, it might be 93 // |extensions| is a list of allowed extensions. For example, it might be
103 // { { "htm", "html" }, { "txt" } }. Only pass more than one extension 94 // { { "htm", "html" }, { "txt" } }. Only pass more than one extension
104 // in the inner vector if the extensions are equivalent. Do NOT include 95 // in the inner vector if the extensions are equivalent. Do NOT include
105 // leading periods. 96 // leading periods.
106 // |extension_description_overrides| overrides the system descriptions of the 97 // |extension_description_overrides| overrides the system descriptions of the
107 // specified extensions. Entries correspond to |extensions|; if left blank 98 // specified extensions. Entries correspond to |extensions|; if left blank
108 // the system descriptions will be used. 99 // the system descriptions will be used.
109 // |include_all_files| specifies whether there will be a filter added for all 100 // |include_all_files| specifies whether there will be a filter added for all
(...skipping 21 matching lines...) Expand all
131 // |default_path| is the default path and suggested file name to be shown in 122 // |default_path| is the default path and suggested file name to be shown in
132 // the dialog. This only works for SELECT_SAVEAS_FILE and SELECT_OPEN_FILE. 123 // the dialog. This only works for SELECT_SAVEAS_FILE and SELECT_OPEN_FILE.
133 // Can be an empty string to indicate the platform default. 124 // Can be an empty string to indicate the platform default.
134 // |file_types| holds the information about the file types allowed. Pass NULL 125 // |file_types| holds the information about the file types allowed. Pass NULL
135 // to get no special behavior 126 // to get no special behavior
136 // |file_type_index| is the 1-based index into the file type list in 127 // |file_type_index| is the 1-based index into the file type list in
137 // |file_types|. Specify 0 if you don't need to specify extension behavior. 128 // |file_types|. Specify 0 if you don't need to specify extension behavior.
138 // |default_extension| is the default extension to add to the file if the 129 // |default_extension| is the default extension to add to the file if the
139 // user doesn't type one. This should NOT include the '.'. On Windows, if 130 // user doesn't type one. This should NOT include the '.'. On Windows, if
140 // you specify this you must also specify |file_types|. 131 // you specify this you must also specify |file_types|.
132 // |source_contents| is the WebContents the call is originating from, i.e.
133 // where the InfoBar should be shown in case file-selection dialogs are
134 // forbidden by policy, or NULL if no InfoBar should be shown.
141 // |owning_window| is the window the dialog is modal to, or NULL for a 135 // |owning_window| is the window the dialog is modal to, or NULL for a
142 // modeless dialog. 136 // modeless dialog.
143 // |params| is data from the calling context which will be passed through to 137 // |params| is data from the calling context which will be passed through to
144 // the listener. Can be NULL. 138 // the listener. Can be NULL.
145 // NOTE: only one instance of any shell dialog can be shown per owning_window 139 // NOTE: only one instance of any shell dialog can be shown per owning_window
146 // at a time (for obvious reasons). 140 // at a time (for obvious reasons).
147 void SelectFile(Type type, 141 void SelectFile(Type type,
148 const string16& title, 142 const string16& title,
149 const FilePath& default_path, 143 const FilePath& default_path,
150 const FileTypeInfo* file_types, 144 const FileTypeInfo* file_types,
151 int file_type_index, 145 int file_type_index,
152 const FilePath::StringType& default_extension, 146 const FilePath::StringType& default_extension,
147 content::WebContents* source_contents,
153 gfx::NativeWindow owning_window, 148 gfx::NativeWindow owning_window,
154 void* params); 149 void* params);
155 bool HasMultipleFileTypeChoices(); 150 bool HasMultipleFileTypeChoices();
156 151
157 protected: 152 protected:
158 friend class base::RefCountedThreadSafe<SelectFileDialog>; 153 friend class base::RefCountedThreadSafe<SelectFileDialog>;
159 explicit SelectFileDialog(Listener* listener, 154 explicit SelectFileDialog(Listener* listener);
160 ui::SelectFilePolicy* policy);
161 virtual ~SelectFileDialog(); 155 virtual ~SelectFileDialog();
162 156
163 // Displays the actual file-selection dialog. 157 // Displays the actual file-selection dialog.
164 // This is overridden in the platform-specific descendants of FileSelectDialog 158 // This is overridden in the platform-specific descendants of FileSelectDialog
165 // and gets called from SelectFile after testing the 159 // and gets called from SelectFile after testing the
166 // AllowFileSelectionDialogs-Policy. 160 // AllowFileSelectionDialogs-Policy.
167 virtual void SelectFileImpl(Type type, 161 virtual void SelectFileImpl(Type type,
168 const string16& title, 162 const string16& title,
169 const FilePath& default_path, 163 const FilePath& default_path,
170 const FileTypeInfo* file_types, 164 const FileTypeInfo* file_types,
(...skipping 10 matching lines...) Expand all
181 // testing if the AllowFileSelectionDialogs-Policy is 175 // testing if the AllowFileSelectionDialogs-Policy is
182 // either unset or set to true. 176 // either unset or set to true.
183 bool CanOpenSelectFileDialog(); 177 bool CanOpenSelectFileDialog();
184 178
185 // Informs the |listener_| that the file selection dialog was canceled. Moved 179 // Informs the |listener_| that the file selection dialog was canceled. Moved
186 // to a function for being able to post it to the message loop. 180 // to a function for being able to post it to the message loop.
187 void CancelFileSelection(void* params); 181 void CancelFileSelection(void* params);
188 182
189 // Returns true if the dialog has multiple file type choices. 183 // Returns true if the dialog has multiple file type choices.
190 virtual bool HasMultipleFileTypeChoicesImpl() = 0; 184 virtual bool HasMultipleFileTypeChoicesImpl() = 0;
191
192 scoped_ptr<ui::SelectFilePolicy> select_file_policy_;
193
194 DISALLOW_COPY_AND_ASSIGN(SelectFileDialog);
195 }; 185 };
196 186
197 #endif // CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_ 187 #endif // CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/select_file_dialog_impl_kde.cc ('k') | chrome/browser/ui/select_file_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698