summaryrefslogtreecommitdiffstats
path: root/chrome/common/render_messages.h
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 19:52:47 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-30 19:52:47 +0000
commitcdaf8d04617e815d8e8fb0fe1c707a23cc583904 (patch)
treeb323d372b6e01fe6d13e37b8a50016386bd6142e /chrome/common/render_messages.h
parent39c4e1a8b2343b3883a098a8e0d21fb8bd3204cf (diff)
downloadchromium_src-cdaf8d04617e815d8e8fb0fe1c707a23cc583904.zip
chromium_src-cdaf8d04617e815d8e8fb0fe1c707a23cc583904.tar.gz
chromium_src-cdaf8d04617e815d8e8fb0fe1c707a23cc583904.tar.bz2
Extend the file browser/chooser to support more modes of operation, and plumb
it through to the pepper API. This pepper API just supports adding the filename to the "upload files" whitelist and returning it to the plugin, but it does not actually give any ability for a sandboxed plugin to read the file (this will come in a separate changelist). TEST=none BUG=none Review URL: http://codereview.chromium.org/1094004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/render_messages.h')
-rw-r--r--chrome/common/render_messages.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 808f668..46cd37b 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -631,6 +631,29 @@ struct ViewHostMsg_TranslateTextParam {
bool secure;
};
+struct ViewHostMsg_RunFileChooser_Params {
+ enum Mode {
+ // Requires that the file exists before allowing the user to pick it.
+ Open,
+
+ // Like Open, but allows picking multiple files to open.
+ OpenMultiple,
+
+ // Allows picking a nonexistant file, and prompts to overwrite if the file
+ // already exists.
+ Save,
+ };
+
+ Mode mode;
+
+ // Title to be used for the dialog. This may be empty for the default title,
+ // which will be either "Open" or "Save" depending on the mode.
+ string16 title;
+
+ // Default file name to select in the dialog.
+ FilePath default_file_name;
+};
+
namespace IPC {
template <>
@@ -2666,6 +2689,47 @@ struct SimilarTypeTraits<TranslateErrors::Type> {
typedef int Type;
};
+template<>
+struct ParamTraits<ViewHostMsg_RunFileChooser_Params> {
+ typedef ViewHostMsg_RunFileChooser_Params param_type;
+ static void Write(Message* m, const param_type& p) {
+ WriteParam(m, static_cast<int>(p.mode));
+ WriteParam(m, p.title);
+ WriteParam(m, p.default_file_name);
+ }
+ static bool Read(const Message* m, void** iter, param_type* p) {
+ int mode;
+ if (!ReadParam(m, iter, &mode))
+ return false;
+ if (mode != param_type::Open &&
+ mode != param_type::OpenMultiple &&
+ mode != param_type::Save)
+ return false;
+ p->mode = static_cast<param_type::Mode>(mode);
+ return
+ ReadParam(m, iter, &p->title) &&
+ ReadParam(m, iter, &p->default_file_name);
+ };
+ static void Log(const param_type& p, std::wstring* l) {
+ switch (p.mode) {
+ case param_type::Open:
+ l->append(L"(Open, ");
+ break;
+ case param_type::OpenMultiple:
+ l->append(L"(OpenMultiple, ");
+ break;
+ case param_type::Save:
+ l->append(L"(Save, ");
+ break;
+ default:
+ l->append(L"(UNKNOWN, ");
+ }
+ LogParam(p.title, l);
+ l->append(L", ");
+ LogParam(p.default_file_name, l);
+ }
+};
+
} // namespace IPC