COMMIT_MESSAGE

 1filechooser
 2

WebKit/chromium/ChangeLog

 12009-12-12 Kent Tamura <tkent@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Add two parameters to WebViewClient::runFileChooser().
 6 - selected filenames
 7 - accept attribute value
 8 https://bugs.webkit.org/show_bug.cgi?id=32473
 9
 10 * public/WebViewClient.h:
 11 (WebKit::WebViewClient::runFileChooser):
 12 * src/ChromeClientImpl.cpp:
 13 (WebKit::ChromeClientImpl::runOpenPanel):
 14
1152009-12-11 Nate Chapin <japhet@chromium.org>
216
317 Reviewed by Darin Fisher.

WebKit/chromium/public/WebViewClient.h

@@public:
161161 // dialog is closed, it should call the WebFileChooserCompletion to
162162 // pass the results of the dialog. Returns false if
163163 // WebFileChooseCompletion will never be called.
 164 // If |multiSelect| is true, the dialog allows to select multiple
 165 // files.
 166 // |initialValue| is a filename which the dialog should select by
 167 // default. It can be an empty string.
 168 // |selectedFiles| has filenames which a file upload control
 169 // already select. A WebViewClient implementation may ask a user
 170 // to select removing a file from the selected files, appending
 171 // other files, or replacing with other files before opening the dialog.
 172 // |acceptTypes| has a comma-separated MIME types such as
 173 // "audio/*,text/plain". The dialog may restrict selectable files
 174 // to the specified types. This value comes from an 'accept'
 175 // attribute value of an INPUT element. So it might has a wrong
 176 // formatted string.
164177 virtual bool runFileChooser(
165178 bool multiSelect, const WebString& title,
166  const WebString& initialValue, WebFileChooserCompletion*) { return false; }
 179 const WebString& initialValue,
 180 const WebVector<WebString>& selectedFiles, const WebString& acceptTypes,
 181 WebFileChooserCompletion*) { return false; }
167182
168183 // Displays a modal alert dialog containing the given message. Returns
169184 // once the user dismisses the dialog.

WebKit/chromium/src/ChromeClientImpl.cpp

@@void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileCh
561561 return;
562562
563563 bool multipleFiles = fileChooser->allowsMultipleFiles();
 564 const Vector<String>& selectedFiles = fileChooser->filenames();
 565 WebVector<WebString> webSelectedFiles(selectedFiles);
 566 WebString acceptTypes(fileChooser->acceptTypes());
564567
565568 WebString suggestion;
566  if (fileChooser->filenames().size() > 0)
567  suggestion = fileChooser->filenames()[0];
 569 if (selectedFiles.size() > 0)
 570 suggestion = selectedFiles[0];
568571
569572 WebFileChooserCompletionImpl* chooserCompletion =
570573 new WebFileChooserCompletionImpl(fileChooser);
571574 bool ok = client->runFileChooser(multipleFiles,
572575 WebString(),
573576 suggestion,
 577 webSelectedFiles,
 578 acceptTypes,
574579 chooserCompletion);
575580 if (!ok) {
576581 // Choosing failed, so do callback with an empty list.