summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-15 00:18:04 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-15 00:18:04 +0000
commitb518852c1a1ccf23fd3ee12d49895009cb8a5aa0 (patch)
tree09747b8108c0baa5519b65ddcffc6db37743b1f7
parent520c202f47822bb9e812a552c8672fc3c7182103 (diff)
downloadchromium_src-b518852c1a1ccf23fd3ee12d49895009cb8a5aa0.zip
chromium_src-b518852c1a1ccf23fd3ee12d49895009cb8a5aa0.tar.gz
chromium_src-b518852c1a1ccf23fd3ee12d49895009cb8a5aa0.tar.bz2
gdata: Pass display names to to the file chooser listener.
The display names are used for showing the file names in web pages, and for uploading. BUG=chromium-os:27222 TEST=manually confirm that file selection on chrome os works, the files are displayed and uploaded properly. Review URL: https://chromiumcodereview.appspot.com/9700009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126798 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/extensions/file_browser_private_api.cc104
-rw-r--r--chrome/browser/chromeos/extensions/file_browser_private_api.h29
-rw-r--r--chrome/browser/ui/views/select_file_dialog_extension.cc16
-rw-r--r--chrome/browser/ui/views/select_file_dialog_extension.h12
-rw-r--r--chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc7
-rw-r--r--chrome/browser/ui/views/select_file_dialog_extension_unittest.cc6
-rw-r--r--content/renderer/render_view_impl.cc17
7 files changed, 113 insertions, 78 deletions
diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.cc b/chrome/browser/chromeos/extensions/file_browser_private_api.cc
index 8222f6b..6ac7a38 100644
--- a/chrome/browser/chromeos/extensions/file_browser_private_api.cc
+++ b/chrome/browser/chromeos/extensions/file_browser_private_api.cc
@@ -36,6 +36,7 @@
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
+#include "content/public/common/selected_file_info.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "grit/platform_locale_settings.h"
@@ -703,7 +704,7 @@ void FileBrowserFunction::GetLocalPathsOnFileThread(
const UrlList& file_urls,
GetLocalPathsCallback callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- FilePathList selected_files;
+ std::vector<content::SelectedFileInfo> selected_files;
// FilePath(virtual_path) doesn't work on win, so limit this to ChromeOS.
#if defined(OS_CHROMEOS)
@@ -749,41 +750,43 @@ void FileBrowserFunction::GetLocalPathsOnFileThread(
}
}
- // If "localPath" is not found, build the real path from |file_url|.
- if (real_path.empty()) {
- GURL file_origin_url;
- FilePath virtual_path;
- fileapi::FileSystemType type;
+ // Extract the path from |file_url|.
+ GURL file_origin_url;
+ FilePath virtual_path;
+ fileapi::FileSystemType type;
- if (!CrackFileSystemURL(file_url, &file_origin_url, &type,
- &virtual_path)) {
- continue;
- }
- if (type != fileapi::kFileSystemTypeExternal) {
- NOTREACHED();
- continue;
- }
+ if (!CrackFileSystemURL(file_url, &file_origin_url, &type,
+ &virtual_path)) {
+ continue;
+ }
+ if (type != fileapi::kFileSystemTypeExternal) {
+ NOTREACHED();
+ continue;
+ }
- FilePath root = provider->GetFileSystemRootPathOnFileThread(
- origin_url,
- fileapi::kFileSystemTypeExternal,
- FilePath(virtual_path),
- false);
- if (!root.empty()) {
+ FilePath::StringType display_name;
+ FilePath root = provider->GetFileSystemRootPathOnFileThread(
+ origin_url,
+ fileapi::kFileSystemTypeExternal,
+ FilePath(virtual_path),
+ false);
+ if (!root.empty()) {
+ // If we haven't got the real path from "localPath", use it as the
+ // real path. Otherwise, use it as the display name.
+ if (real_path.empty())
real_path = root.Append(virtual_path);
- } else {
- LOG(WARNING) << "GetLocalPathsOnFileThread failed "
- << file_url.spec();
- }
+ else
+ display_name = virtual_path.BaseName().value();
+ } else {
+ LOG(WARNING) << "GetLocalPathsOnFileThread failed "
+ << file_url.spec();
}
- // TODO(satorux): The real path is human unreadable if the file is
- // originated from gdata. We should propagate the display name to the
- // WebKit layer, so the right name is displayed in the web page, and
- // used for uploading. crosbug.com/27222.
if (!real_path.empty()) {
- DVLOG(1) << "Selected: " << real_path.value();
- selected_files.push_back(real_path);
+ DVLOG(1) << "Selected: real path: " << real_path.value()
+ << " display name: " << display_name;
+ selected_files.push_back(
+ content::SelectedFileInfo(real_path, display_name));
}
}
#endif
@@ -808,7 +811,7 @@ bool SelectFileFunction::RunImpl() {
}
void SelectFileFunction::GetLocalPathsResponseOnUIThread(
- const FilePathList& files) {
+ const SelectedFileInfoList& files) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (files.size() != 1) {
SendResponse(false);
@@ -859,13 +862,13 @@ bool ViewFilesFunction::RunImpl() {
void ViewFilesFunction::GetLocalPathsResponseOnUIThread(
const std::string& internal_task_id,
- const FilePathList& files) {
+ const SelectedFileInfoList& files) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
bool success = true;
- for (FilePathList::const_iterator iter = files.begin();
+ for (SelectedFileInfoList::const_iterator iter = files.begin();
iter != files.end();
++iter) {
- bool handled = file_manager_util::TryViewingFile(*iter);
+ bool handled = file_manager_util::TryViewingFile(iter->path);
// If there is no default browser-defined handler for viewing this type
// of file, try to see if we have any extension installed for it instead.
if (!handled && files.size() == 1)
@@ -906,7 +909,7 @@ bool SelectFilesFunction::RunImpl() {
}
void SelectFilesFunction::GetLocalPathsResponseOnUIThread(
- const FilePathList& files) {
+ const SelectedFileInfoList& files) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
int32 tab_id = GetTabId();
SelectFileDialogExtension::OnMultiFilesSelected(tab_id, files);
@@ -1021,7 +1024,7 @@ void AddMountFunction::OnGDataAuthentication(gdata::GDataErrorCode error,
void AddMountFunction::GetLocalPathsResponseOnUIThread(
const std::string& mount_type_str,
- const FilePathList& files) {
+ const SelectedFileInfoList& files) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (!files.size()) {
@@ -1030,7 +1033,7 @@ void AddMountFunction::GetLocalPathsResponseOnUIThread(
}
#if defined(OS_CHROMEOS)
- FilePath source_file = files[0];
+ FilePath source_file = files[0].path;
DiskMountManager* disk_mount_manager = DiskMountManager::GetInstance();
// MountPath() takes a std::string.
disk_mount_manager->MountPath(source_file.AsUTF8Unsafe(),
@@ -1065,7 +1068,7 @@ bool RemoveMountFunction::RunImpl() {
}
void RemoveMountFunction::GetLocalPathsResponseOnUIThread(
- const FilePathList& files) {
+ const SelectedFileInfoList& files) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (files.size() != 1) {
@@ -1073,7 +1076,7 @@ void RemoveMountFunction::GetLocalPathsResponseOnUIThread(
return;
}
#if defined(OS_CHROMEOS)
- DiskMountManager::GetInstance()->UnmountPath(files[0].value());
+ DiskMountManager::GetInstance()->UnmountPath(files[0].path.value());
#endif
SendResponse(true);
@@ -1135,7 +1138,7 @@ bool GetSizeStatsFunction::RunImpl() {
}
void GetSizeStatsFunction::GetLocalPathsResponseOnUIThread(
- const FilePathList& files) {
+ const SelectedFileInfoList& files) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (files.size() != 1) {
@@ -1148,7 +1151,7 @@ void GetSizeStatsFunction::GetLocalPathsResponseOnUIThread(
base::Bind(
&GetSizeStatsFunction::CallGetSizeStatsOnFileThread,
this,
- files[0].value()));
+ files[0].path.value()));
}
void GetSizeStatsFunction::CallGetSizeStatsOnFileThread(
@@ -1212,7 +1215,7 @@ bool FormatDeviceFunction::RunImpl() {
}
void FormatDeviceFunction::GetLocalPathsResponseOnUIThread(
- const FilePathList& files) {
+ const SelectedFileInfoList& files) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (files.size() != 1) {
@@ -1221,7 +1224,7 @@ void FormatDeviceFunction::GetLocalPathsResponseOnUIThread(
}
#if defined(OS_CHROMEOS)
- DiskMountManager::GetInstance()->FormatMountedDevice(files[0].value());
+ DiskMountManager::GetInstance()->FormatMountedDevice(files[0].path.value());
#endif
SendResponse(true);
@@ -1256,7 +1259,7 @@ bool GetVolumeMetadataFunction::RunImpl() {
}
void GetVolumeMetadataFunction::GetLocalPathsResponseOnUIThread(
- const FilePathList& files) {
+ const SelectedFileInfoList& files) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
// Should contain volume's mount path.
@@ -1269,7 +1272,8 @@ void GetVolumeMetadataFunction::GetLocalPathsResponseOnUIThread(
result_.reset();
#if defined(OS_CHROMEOS)
- const DiskMountManager::Disk* volume = GetVolumeAsDisk(files[0].value());
+ const DiskMountManager::Disk* volume = GetVolumeAsDisk(
+ files[0].path.value());
if (volume) {
DictionaryValue* volume_info =
CreateValueFromDisk(profile_, volume);
@@ -1616,12 +1620,12 @@ bool GetFileLocationsFunction::RunImpl() {
}
void GetFileLocationsFunction::GetLocalPathsResponseOnUIThread(
- const FilePathList& files) {
+ const SelectedFileInfoList& files) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
ListValue* locations = new ListValue;
for (size_t i = 0; i < files.size(); ++i) {
- if (gdata::util::IsUnderGDataMountPoint(files[i])) {
+ if (gdata::util::IsUnderGDataMountPoint(files[i].path)) {
locations->Append(Value::CreateStringValue("gdata"));
} else {
locations->Append(Value::CreateStringValue("local"));
@@ -1661,12 +1665,12 @@ bool GetGDataFilesFunction::RunImpl() {
}
void GetGDataFilesFunction::GetLocalPathsResponseOnUIThread(
- const FilePathList& files) {
+ const SelectedFileInfoList& files) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
for (size_t i = 0; i < files.size(); ++i) {
- DCHECK(gdata::util::IsUnderGDataMountPoint(files[i]));
- FilePath gdata_path = gdata::util::ExtractGDataPath(files[i]);
+ DCHECK(gdata::util::IsUnderGDataMountPoint(files[i].path));
+ FilePath gdata_path = gdata::util::ExtractGDataPath(files[i].path);
remaining_gdata_paths_.push(gdata_path);
}
diff --git a/chrome/browser/chromeos/extensions/file_browser_private_api.h b/chrome/browser/chromeos/extensions/file_browser_private_api.h
index fe8549a..6d2bffc 100644
--- a/chrome/browser/chromeos/extensions/file_browser_private_api.h
+++ b/chrome/browser/chromeos/extensions/file_browser_private_api.h
@@ -18,6 +18,10 @@
class GURL;
+namespace content {
+struct SelectedFileInfo;
+}
+
// Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method.
class RequestLocalFileSystemFunction : public AsyncExtensionFunction {
protected:
@@ -109,8 +113,9 @@ class FileBrowserFunction
protected:
typedef std::vector<GURL> UrlList;
- typedef std::vector<FilePath> FilePathList;
- typedef base::Callback<void(const FilePathList&)> GetLocalPathsCallback;
+ typedef std::vector<content::SelectedFileInfo> SelectedFileInfoList;
+ typedef base::Callback<void(const SelectedFileInfoList&)>
+ GetLocalPathsCallback;
virtual ~FileBrowserFunction();
@@ -146,7 +151,7 @@ class SelectFileFunction
private:
// A callback method to handle the result of
// GetLocalPathsOnFileThreadAndRunCallbackOnUIThread.
- void GetLocalPathsResponseOnUIThread(const FilePathList& files);
+ void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files);
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFile");
};
@@ -167,7 +172,7 @@ class ViewFilesFunction
// A callback method to handle the result of
// GetLocalPathsOnFileThreadAndRunCallbackOnUIThread.
void GetLocalPathsResponseOnUIThread(const std::string& internal_task_id,
- const FilePathList& files);
+ const SelectedFileInfoList& files);
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.viewFiles");
};
@@ -187,7 +192,7 @@ class SelectFilesFunction
private:
// A callback method to handle the result of
// GetLocalPathsOnFileThreadAndRunCallbackOnUIThread.
- void GetLocalPathsResponseOnUIThread(const FilePathList& files);
+ void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files);
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFiles");
};
@@ -231,7 +236,7 @@ class AddMountFunction
// A callback method to handle the result of
// GetLocalPathsOnFileThreadAndRunCallbackOnUIThread.
void GetLocalPathsResponseOnUIThread(const std::string& mount_type_str,
- const FilePathList& files);
+ const SelectedFileInfoList& files);
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.addMount");
};
@@ -251,7 +256,7 @@ class RemoveMountFunction
private:
// A callback method to handle the result of
// GetLocalPathsOnFileThreadAndRunCallbackOnUIThread.
- void GetLocalPathsResponseOnUIThread(const FilePathList& files);
+ void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files);
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.removeMount");
};
@@ -286,7 +291,7 @@ class FormatDeviceFunction
private:
// A callback method to handle the result of
// GetLocalPathsOnFileThreadAndRunCallbackOnUIThread.
- void GetLocalPathsResponseOnUIThread(const FilePathList& files);
+ void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files);
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.formatDevice");
};
@@ -305,7 +310,7 @@ class GetSizeStatsFunction
private:
// A callback method to handle the result of
// GetLocalPathsOnFileThreadAndRunCallbackOnUIThread.
- void GetLocalPathsResponseOnUIThread(const FilePathList& files);
+ void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files);
void GetSizeStatsCallbackOnUIThread(const std::string& mount_path,
size_t total_size_kb,
@@ -329,7 +334,7 @@ class GetVolumeMetadataFunction
private:
// A callback method to handle the result of
// GetLocalPathsOnFileThreadAndRunCallbackOnUIThread.
- void GetLocalPathsResponseOnUIThread(const FilePathList& files);
+ void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files);
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getVolumeMetadata");
};
@@ -433,7 +438,7 @@ class GetFileLocationsFunction : public FileBrowserFunction {
private:
// A callback method to handle the result of
// GetLocalPathsOnFileThreadAndRunCallbackOnUIThread.
- void GetLocalPathsResponseOnUIThread(const FilePathList& files);
+ void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files);
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getFileLocations");
};
@@ -459,7 +464,7 @@ class GetGDataFilesFunction : public FileBrowserFunction {
private:
// A callback method to handle the result of
// GetLocalPathsOnFileThreadAndRunCallbackOnUIThread.
- void GetLocalPathsResponseOnUIThread(const FilePathList& files);
+ void GetLocalPathsResponseOnUIThread(const SelectedFileInfoList& files);
// Gets the file on the top of the |remaining_gdata_paths_| or sends the
// response if the queue is empty.
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc
index 2fb805e..da04c27 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension.cc
+++ b/chrome/browser/ui/views/select_file_dialog_extension.cc
@@ -22,6 +22,7 @@
#include "chrome/browser/ui/views/extensions/extension_dialog.h"
#include "chrome/browser/ui/views/window.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/common/selected_file_info.h"
using content::BrowserThread;
@@ -155,20 +156,23 @@ void SelectFileDialogExtension::ExtensionTerminated(
// static
void SelectFileDialogExtension::OnFileSelected(
- int32 tab_id, const FilePath& path, int index) {
+ int32 tab_id,
+ const content::SelectedFileInfo& file,
+ int index) {
scoped_refptr<SelectFileDialogExtension> dialog =
PendingDialog::GetInstance()->Find(tab_id);
if (!dialog)
return;
dialog->selection_type_ = SINGLE_FILE;
dialog->selection_files_.clear();
- dialog->selection_files_.push_back(path);
+ dialog->selection_files_.push_back(file);
dialog->selection_index_ = index;
}
// static
void SelectFileDialogExtension::OnMultiFilesSelected(
- int32 tab_id, const std::vector<FilePath>& files) {
+ int32 tab_id,
+ const std::vector<content::SelectedFileInfo>& files) {
scoped_refptr<SelectFileDialogExtension> dialog =
PendingDialog::GetInstance()->Find(tab_id);
if (!dialog)
@@ -203,10 +207,12 @@ void SelectFileDialogExtension::NotifyListener() {
listener_->FileSelectionCanceled(params_);
break;
case SINGLE_FILE:
- listener_->FileSelected(selection_files_[0], selection_index_, params_);
+ listener_->FileSelectedWithExtraInfo(selection_files_[0],
+ selection_index_,
+ params_);
break;
case MULTIPLE_FILES:
- listener_->MultiFilesSelected(selection_files_, params_);
+ listener_->MultiFilesSelectedWithExtraInfo(selection_files_, params_);
break;
default:
NOTREACHED();
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.h b/chrome/browser/ui/views/select_file_dialog_extension.h
index bafbe9f..eb91b0d 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension.h
+++ b/chrome/browser/ui/views/select_file_dialog_extension.h
@@ -19,6 +19,7 @@ class ExtensionDialog;
namespace content {
class RenderViewHost;
+struct SelectedFileInfo;
}
// Shows a dialog box for selecting a file or a folder, using the
@@ -40,9 +41,12 @@ class SelectFileDialogExtension
// Routes callback to appropriate SelectFileDialog::Listener based on
// the owning |tab_id|.
- static void OnFileSelected(int32 tab_id, const FilePath& path, int index);
- static void OnMultiFilesSelected(int32 tab_id,
- const std::vector<FilePath>& files);
+ static void OnFileSelected(int32 tab_id,
+ const content::SelectedFileInfo& file,
+ int index);
+ static void OnMultiFilesSelected(
+ int32 tab_id,
+ const std::vector<content::SelectedFileInfo>& files);
static void OnFileSelectionCanceled(int32 tab_id);
// For testing, so we can inject JavaScript into the contained view.
@@ -103,7 +107,7 @@ class SelectFileDialogExtension
MULTIPLE_FILES
};
SelectionType selection_type_;
- std::vector<FilePath> selection_files_;
+ std::vector<content::SelectedFileInfo> selection_files_;
int selection_index_;
void* params_;
diff --git a/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc b/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc
index c296a69..824bc5c 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc
+++ b/chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc
@@ -24,6 +24,7 @@
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_types.h"
#include "content/public/browser/render_view_host.h"
+#include "content/public/common/selected_file_info.h"
#include "webkit/fileapi/file_system_context.h"
#include "webkit/fileapi/file_system_mount_point_provider.h"
@@ -49,6 +50,12 @@ class MockSelectFileDialogListener : public SelectFileDialog::Listener {
path_ = path;
params_ = params;
}
+ virtual void FileSelectedWithExtraInfo(
+ const content::SelectedFileInfo& selected_file_info,
+ int index,
+ void* params) {
+ FileSelected(selected_file_info.path, index, params);
+ }
virtual void MultiFilesSelected(
const std::vector<FilePath>& files, void* params) {}
virtual void FileSelectionCanceled(void* params) {
diff --git a/chrome/browser/ui/views/select_file_dialog_extension_unittest.cc b/chrome/browser/ui/views/select_file_dialog_extension_unittest.cc
index 2adcf03..d01a184 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension_unittest.cc
+++ b/chrome/browser/ui/views/select_file_dialog_extension_unittest.cc
@@ -1,10 +1,11 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/ui/views/select_file_dialog_extension.h"
#include "base/file_path.h"
+#include "content/public/common/selected_file_info.h"
#include "testing/gtest/include/gtest/gtest.h"
class SelectFileDialogExtensionTest : public testing::Test {
@@ -51,7 +52,8 @@ TEST_F(SelectFileDialogExtensionTest, SelfDeleting) {
SelfDeletingClient* client = new SelfDeletingClient(kTabId);
// Ensure we don't crash or trip an Address Sanitizer warning about
// use-after-free.
- SelectFileDialogExtension::OnFileSelected(kTabId, FilePath(), 0);
+ content::SelectedFileInfo file_info;
+ SelectFileDialogExtension::OnFileSelected(kTabId, file_info, 0);
// Simulate closing the dialog so the listener gets invoked.
client->dialog()->ExtensionDialogClosing(NULL);
}
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index d3ca701..525cec2 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -4153,13 +4153,20 @@ void RenderViewImpl::OnFileChooserResponse(
if (file_chooser_completions_.empty())
return;
- WebVector<WebString> ws_file_names(files.size());
- for (size_t i = 0; i < files.size(); ++i)
- ws_file_names[i] = webkit_glue::FilePathToWebString(files[i].path);
+ // Convert Chrome's SelectedFileInfo list to WebKit's.
+ WebVector<WebFileChooserCompletion::SelectedFileInfo> selected_files(
+ files.size());
+ for (size_t i = 0; i < files.size(); ++i) {
+ WebFileChooserCompletion::SelectedFileInfo selected_file;
+ selected_file.path = webkit_glue::FilePathToWebString(files[i].path);
+ selected_file.displayName = webkit_glue::FilePathStringToWebString(
+ files[i].display_name);
+ selected_files[i] = selected_file;
+ }
- // TODO(satorux,kinuko): Pass display names too. crosbug.com/27222
if (file_chooser_completions_.front()->completion)
- file_chooser_completions_.front()->completion->didChooseFile(ws_file_names);
+ file_chooser_completions_.front()->completion->didChooseFile(
+ selected_files);
file_chooser_completions_.pop_front();
// If there are more pending file chooser requests, schedule one now.