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

Unified Diff: webkit/glue/chrome_client_impl.cc

Issue 18285: Adding support for multiple files in FileChooser (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/chrome_client_impl.cc
===================================================================
--- webkit/glue/chrome_client_impl.cc (revision 7989)
+++ webkit/glue/chrome_client_impl.cc (working copy)
@@ -43,12 +43,18 @@
}
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""));
+ file_chooser_->chooseFile(WebCore::String(""));
+ } else if (file_names.size() == 1) {
+ file_chooser_->chooseFile(
+ webkit_glue::StdWStringToString(file_names.front()));
} else {
- file_chooser_->chooseFile(
- webkit_glue::StdWStringToString(file_names.front().c_str()));
+ 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 @@
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);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698