From 212476da17fa6558cbb686eae3e087dfcd4f480d Mon Sep 17 00:00:00 2001 From: "tkent@chromium.org" Date: Thu, 18 Jun 2009 07:39:50 +0000 Subject: Don't call FileChooser::chooseFile("") if a user selects nothing with a file chooser dialog. chooseFiles() works well even for an empty vector. BUG=14162,14164 TEST=Open an image upload dialog of Gmail or Google Sites, Click the file upload button, Click the Cancel button in the file chooser dialog. Confirm that the dialog doesn't show "[failed]" message. Review URL: http://codereview.chromium.org/125175 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18696 0039d316-1c4b-4281-b951-d872f2087c98 --- webkit/glue/chrome_client_impl.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'webkit/glue') diff --git a/webkit/glue/chrome_client_impl.cc b/webkit/glue/chrome_client_impl.cc index 4b6ab72..160833e 100644 --- a/webkit/glue/chrome_client_impl.cc +++ b/webkit/glue/chrome_client_impl.cc @@ -60,12 +60,11 @@ class WebFileChooserCallbackImpl : public WebFileChooserCallback { } virtual void OnFileChoose(const std::vector& file_names) { - if (file_names.empty()) { - file_chooser_->chooseFile(WebCore::String("")); - } else if (file_names.size() == 1) { + if (file_names.size() == 1) { file_chooser_->chooseFile( webkit_glue::FilePathStringToString(file_names.front().value())); } else { + // This clause handles a case of file_names.size()==0 too. Vector paths; for (std::vector::const_iterator filename = file_names.begin(); filename != file_names.end(); ++filename) { -- cgit v1.1