summaryrefslogtreecommitdiffstats
path: root/webkit/glue/chrome_client_impl.cc
diff options
context:
space:
mode:
authorzork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 23:25:17 +0000
committerzork@google.com <zork@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-15 23:25:17 +0000
commit778953d8e600037a5d7ba8d26d9a7f988b822e5c (patch)
tree7042876004a7895a597a8c1dd6d8fcb1f9c4f5d5 /webkit/glue/chrome_client_impl.cc
parent55fa0e25961304216b0f6bd37c5a3132dc71106d (diff)
downloadchromium_src-778953d8e600037a5d7ba8d26d9a7f988b822e5c.zip
chromium_src-778953d8e600037a5d7ba8d26d9a7f988b822e5c.tar.gz
chromium_src-778953d8e600037a5d7ba8d26d9a7f988b822e5c.tar.bz2
Adding support for multiple files in FileChooser
BUG=4358 R=darin Review URL: http://codereview.chromium.org/18285 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8134 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/chrome_client_impl.cc')
-rw-r--r--webkit/glue/chrome_client_impl.cc18
1 files changed, 13 insertions, 5 deletions
diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc
index d19c28c..6a04764 100644
--- a/webkit/glue/chrome_client_impl.cc
+++ b/webkit/glue/chrome_client_impl.cc
@@ -43,12 +43,18 @@ class WebFileChooserCallbackImpl : public WebFileChooserCallback {
}
void OnFileChoose(const std::vector<std::wstring>& file_names) {
- assert(file_names.size() <= 1);
if (file_names.empty()) {
- file_chooser_->chooseFile(webkit_glue::StdWStringToString(L""));
- } else {
+ file_chooser_->chooseFile(WebCore::String(""));
+ } else if (file_names.size() == 1) {
file_chooser_->chooseFile(
- webkit_glue::StdWStringToString(file_names.front().c_str()));
+ webkit_glue::StdWStringToString(file_names.front()));
+ } else {
+ Vector<WebCore::String> paths;
+ for (std::vector<std::wstring>::const_iterator filename =
+ file_names.begin(); filename != file_names.end(); ++filename) {
+ paths.append(webkit_glue::StdWStringToString(*filename));
+ }
+ file_chooser_->chooseFiles(paths);
}
}
@@ -458,12 +464,14 @@ void ChromeClientImpl::runOpenPanel(WebCore::Frame* frame,
if (!delegate)
return;
+ bool multiple_files = fileChooser->allowsMultipleFiles();
+
std::wstring suggestion;
if (fileChooser->filenames().size() > 0)
suggestion = webkit_glue::StringToStdWString(fileChooser->filenames()[0]);
WebFileChooserCallbackImpl* chooser = new WebFileChooserCallbackImpl(fileChooser);
- delegate->RunFileChooser(false, std::wstring(), suggestion,
+ delegate->RunFileChooser(multiple_files, std::wstring(), suggestion,
std::wstring(), chooser);
}