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

Unified Diff: chrome/browser/ui/select_file_dialog.h

Issue 10667026: Start consolidating cross-port file selection code into ui/base/dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/select_file_dialog.h
diff --git a/chrome/browser/ui/select_file_dialog.h b/chrome/browser/ui/select_file_dialog.h
index 081c787563fb7602f7b57828b86c3ef47fd19b25..4d5ade41e2b1624a109866af147d990417efb605 100644
--- a/chrome/browser/ui/select_file_dialog.h
+++ b/chrome/browser/ui/select_file_dialog.h
@@ -9,12 +9,17 @@
#include <string>
#include <vector>
+#include "base/callback_forward.h"
#include "base/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/string16.h"
-#include "chrome/browser/ui/base_shell_dialog.h"
+#include "ui/base/dialogs/base_shell_dialog.h"
#include "ui/gfx/native_widget_types.h"
+namespace ui {
+class SelectFilePolicy;
+}
+
namespace content {
class WebContents;
struct SelectedFileInfo;
@@ -29,7 +34,7 @@ extern std::wstring AppendExtensionIfNeeded(const std::wstring& filename,
// Shows a dialog box for selecting a file or a folder.
class SelectFileDialog
: public base::RefCountedThreadSafe<SelectFileDialog>,
- public BaseShellDialog {
+ public ui::BaseShellDialog {
public:
enum Type {
SELECT_NONE,
@@ -82,6 +87,10 @@ class SelectFileDialog
virtual ~Listener() {}
};
+ // Sets the global file policy class. This is an optional class that lets the
+ // implementer block the showing of file dialogs.
+ static void SetFilePolicy(ui::SelectFilePolicy* policy);
+
// Creates a dialog box helper. This object is ref-counted, but the returned
// object will have no reference (refcount is 0).
static SelectFileDialog* Create(Listener* listener);
@@ -126,9 +135,9 @@ class SelectFileDialog
// |default_extension| is the default extension to add to the file if the
// user doesn't type one. This should NOT include the '.'. On Windows, if
// you specify this you must also specify |file_types|.
- // |source_contents| is the WebContents the call is originating from, i.e.
- // where the InfoBar should be shown in case file-selection dialogs are
- // forbidden by policy, or NULL if no InfoBar should be shown.
+ // |policy_denied| is a closure called if there is a ui::SelectFilePolicy
+ // object which denied opening this dialog. Pass an empty closure if you
+ // want no action to be taken.
// |owning_window| is the window the dialog is modal to, or NULL for a
// modeless dialog.
// |params| is data from the calling context which will be passed through to
@@ -141,7 +150,7 @@ class SelectFileDialog
const FileTypeInfo* file_types,
int file_type_index,
const FilePath::StringType& default_extension,
- content::WebContents* source_contents,
+ const base::Closure& policy_denied,
gfx::NativeWindow owning_window,
void* params);
bool HasMultipleFileTypeChoices();
@@ -179,6 +188,8 @@ class SelectFileDialog
// Returns true if the dialog has multiple file type choices.
virtual bool HasMultipleFileTypeChoicesImpl() = 0;
+
+ static ui::SelectFilePolicy* select_file_policy_;
};
#endif // CHROME_BROWSER_UI_SELECT_FILE_DIALOG_H_

Powered by Google App Engine
This is Rietveld 408576698