summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-09 07:07:54 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-09 07:07:54 +0000
commitad688f24f2931740f5c570b1ed89ae628950a857 (patch)
tree0e82a57225d135b72c4051b5f57b46c07a0b070d
parent294987d4e9a4c6bcd748d2b30ee8a8f39fa179a6 (diff)
downloadchromium_src-ad688f24f2931740f5c570b1ed89ae628950a857.zip
chromium_src-ad688f24f2931740f5c570b1ed89ae628950a857.tar.gz
chromium_src-ad688f24f2931740f5c570b1ed89ae628950a857.tar.bz2
Add plumbing for file display names for drag and drop
On HTML5 file system, the real path names are human-unreadable hence we should propagate human-readable display names when performing drag-and-drop. WebKit patch was in http://trac.webkit.org/changeset/116186 FWIW, I originally added display_names to WebDropData but the resulting code was not desirable: - checking if the size of |display_names| match with |file_names| is not clean (parallel arrays like these are not good in general) - adding GetDisplayNames/SetDisplayNames() to every Provider implementation looked more complicated than changing the existing GetFilenames/SetFilenames() to take a struct. BUG=chromium-os:30419,chromium-os:30665 TEST=confirm that the correct file name is shown by the steps described in crosbug.co/30665 Review URL: https://chromiumcodereview.appspot.com/10382056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136000 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc3
-rw-r--r--chrome/browser/ui/webui/extensions/install_extension_handler.cc2
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc4
-rw-r--r--content/browser/renderer_host/render_view_host_impl.cc10
-rw-r--r--content/browser/web_contents/web_contents_view_aura.cc27
-rw-r--r--content/browser/web_contents/web_drag_dest_gtk.cc4
-rw-r--r--content/browser/web_contents/web_drag_dest_mac.mm7
-rw-r--r--content/common/drag_messages.h5
-rw-r--r--ui/base/dragdrop/os_exchange_data.cc19
-rw-r--r--ui/base/dragdrop/os_exchange_data.h25
-rw-r--r--ui/base/dragdrop/os_exchange_data_provider_aura.cc12
-rw-r--r--ui/base/dragdrop/os_exchange_data_provider_aura.h8
-rw-r--r--ui/base/dragdrop/os_exchange_data_provider_gtk.h6
-rw-r--r--ui/base/dragdrop/os_exchange_data_provider_win.h6
-rw-r--r--webkit/glue/webdropdata.cc20
-rw-r--r--webkit/glue/webdropdata.h13
-rw-r--r--webkit/glue/webdropdata_win.cc5
17 files changed, 127 insertions, 49 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 0af7585..ea91a5e 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -1181,7 +1181,8 @@ void TestingAutomationProvider::DragAndDropFilePaths(
return;
}
- drop_data.filenames.push_back(path);
+ drop_data.filenames.push_back(
+ WebDropData::FileInfo(path, string16()));
}
const gfx::Point client(x, y);
diff --git a/chrome/browser/ui/webui/extensions/install_extension_handler.cc b/chrome/browser/ui/webui/extensions/install_extension_handler.cc
index 042e31a..6bdd022 100644
--- a/chrome/browser/ui/webui/extensions/install_extension_handler.cc
+++ b/chrome/browser/ui/webui/extensions/install_extension_handler.cc
@@ -64,7 +64,7 @@ void InstallExtensionHandler::HandleStartDragMessage(const ListValue* args) {
}
file_to_install_ = FilePath::FromWStringHack(
- UTF16ToWide(drop_data->filenames.front()));
+ UTF16ToWide(drop_data->filenames.front().path));
}
void InstallExtensionHandler::HandleStopDragMessage(const ListValue* args) {
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index ee39b00..7c086c6 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -208,8 +208,8 @@ void ChromeContentRendererClient::RenderThreadStarted() {
#if defined(OS_CHROMEOS)
WebString drive_scheme(ASCIIToUTF16(chrome::kDriveScheme));
- WebSecurityPolicy::registerURLSchemeAsLocal(drive_scheme);
- WebSecurityPolicy::registerURLSchemeAsNoAccess(drive_scheme);
+ WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(drive_scheme);
+ //WebSecurityPolicy::registerURLSchemeAsNoAccess(drive_scheme);
#endif
// chrome: pages should not be accessible by bookmarklets or javascript:
diff --git a/content/browser/renderer_host/render_view_host_impl.cc b/content/browser/renderer_host/render_view_host_impl.cc
index fd4e26c..7d5235a 100644
--- a/content/browser/renderer_host/render_view_host_impl.cc
+++ b/content/browser/renderer_host/render_view_host_impl.cc
@@ -579,9 +579,10 @@ void RenderViewHostImpl::DragTargetDragEnter(
// The filenames vector, on the other hand, does represent a capability to
// access the given files.
std::set<FilePath> filesets;
- for (std::vector<string16>::iterator iter(filtered_data.filenames.begin());
+ for (std::vector<WebDropData::FileInfo>::const_iterator iter(
+ filtered_data.filenames.begin());
iter != filtered_data.filenames.end(); ++iter) {
- FilePath path = FilePath::FromWStringHack(UTF16ToWideHack(*iter));
+ FilePath path = FilePath::FromUTF8Unsafe(UTF16ToUTF8(iter->path));
policy->GrantRequestURL(renderer_id, net::FilePathToFileURL(path));
// If the renderer already has permission to read these paths, we don't need
@@ -1384,9 +1385,10 @@ void RenderViewHostImpl::OnMsgStartDragging(
// still fire though, which causes read permissions to be granted to the
// renderer for any file paths in the drop.
filtered_data.filenames.clear();
- for (std::vector<string16>::const_iterator it = drop_data.filenames.begin();
+ for (std::vector<WebDropData::FileInfo>::const_iterator it =
+ drop_data.filenames.begin();
it != drop_data.filenames.end(); ++it) {
- FilePath path(FilePath::FromUTF8Unsafe(UTF16ToUTF8(*it)));
+ FilePath path(FilePath::FromUTF8Unsafe(UTF16ToUTF8(it->path)));
if (policy->CanReadFile(GetProcess()->GetID(), path))
filtered_data.filenames.push_back(*it);
}
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index cbf9ec2..2971c36 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -86,11 +86,16 @@ void PrepareDragData(const WebDropData& drop_data,
if (!drop_data.text_html.empty())
provider->SetHtml(drop_data.text_html, drop_data.html_base_url);
if (!drop_data.filenames.empty()) {
- std::vector<FilePath> paths;
- for (std::vector<string16>::const_iterator it = drop_data.filenames.begin();
- it != drop_data.filenames.end(); ++it)
- paths.push_back(FilePath::FromUTF8Unsafe(UTF16ToUTF8(*it)));
- provider->SetFilenames(paths);
+ std::vector<ui::OSExchangeData::FileInfo> filenames;
+ for (std::vector<WebDropData::FileInfo>::const_iterator it =
+ drop_data.filenames.begin();
+ it != drop_data.filenames.end(); ++it) {
+ filenames.push_back(
+ ui::OSExchangeData::FileInfo(
+ FilePath::FromUTF8Unsafe(UTF16ToUTF8(it->path)),
+ FilePath::FromUTF8Unsafe(UTF16ToUTF8(it->display_name))));
+ }
+ provider->SetFilenames(filenames);
}
if (!drop_data.custom_data.empty()) {
Pickle pickle;
@@ -118,11 +123,15 @@ void PrepareWebDropData(WebDropData* drop_data,
data.GetHtml(&drop_data->text_html, &drop_data->html_base_url);
- std::vector<FilePath> files;
+ std::vector<ui::OSExchangeData::FileInfo> files;
if (data.GetFilenames(&files) && !files.empty()) {
- for (std::vector<FilePath>::const_iterator it = files.begin();
- it != files.end(); ++it)
- drop_data->filenames.push_back(UTF8ToUTF16(it->AsUTF8Unsafe()));
+ for (std::vector<ui::OSExchangeData::FileInfo>::const_iterator
+ it = files.begin(); it != files.end(); ++it) {
+ drop_data->filenames.push_back(
+ WebDropData::FileInfo(
+ UTF8ToUTF16(it->path.AsUTF8Unsafe()),
+ UTF8ToUTF16(it->display_name.AsUTF8Unsafe())));
+ }
}
Pickle pickle;
diff --git a/content/browser/web_contents/web_drag_dest_gtk.cc b/content/browser/web_contents/web_drag_dest_gtk.cc
index c3cf97a..3f19213 100644
--- a/content/browser/web_contents/web_drag_dest_gtk.cc
+++ b/content/browser/web_contents/web_drag_dest_gtk.cc
@@ -171,7 +171,9 @@ void WebDragDestGtk::OnDragDataReceived(
FilePath file_path;
if (url.SchemeIs(chrome::kFileScheme) &&
net::FileURLToFilePath(url, &file_path)) {
- drop_data_->filenames.push_back(UTF8ToUTF16(file_path.value()));
+ drop_data_->filenames.push_back(
+ WebDropData::FileInfo(UTF8ToUTF16(file_path.value()),
+ string16()));
// This is a hack. Some file managers also populate text/plain with
// a file URL when dragging files, so we clear it to avoid exposing
// it to the web content.
diff --git a/content/browser/web_contents/web_drag_dest_mac.mm b/content/browser/web_contents/web_drag_dest_mac.mm
index 7ba78b53..dd945fc 100644
--- a/content/browser/web_contents/web_drag_dest_mac.mm
+++ b/content/browser/web_contents/web_drag_dest_mac.mm
@@ -240,8 +240,11 @@ using content::Referrer;
BOOL isDir = NO;
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:filename
isDirectory:&isDir];
- if (exists && !isDir)
- data->filenames.push_back(base::SysNSStringToUTF16(filename));
+ if (exists && !isDir) {
+ data->filenames.push_back(
+ WebDropData::FileInfo(
+ base::SysNSStringToUTF16(filename), string16()));
+ }
}
}
}
diff --git a/content/common/drag_messages.h b/content/common/drag_messages.h
index 793b1f0..730782b 100644
--- a/content/common/drag_messages.h
+++ b/content/common/drag_messages.h
@@ -16,6 +16,11 @@
IPC_ENUM_TRAITS(WebKit::WebDragOperation)
+IPC_STRUCT_TRAITS_BEGIN(WebDropData::FileInfo)
+ IPC_STRUCT_TRAITS_MEMBER(path)
+ IPC_STRUCT_TRAITS_MEMBER(display_name)
+IPC_STRUCT_TRAITS_END()
+
IPC_STRUCT_TRAITS_BEGIN(WebDropData)
IPC_STRUCT_TRAITS_MEMBER(url)
IPC_STRUCT_TRAITS_MEMBER(url_title)
diff --git a/ui/base/dragdrop/os_exchange_data.cc b/ui/base/dragdrop/os_exchange_data.cc
index c0b066c..12eddeb 100644
--- a/ui/base/dragdrop/os_exchange_data.cc
+++ b/ui/base/dragdrop/os_exchange_data.cc
@@ -18,6 +18,15 @@ OSExchangeData::DownloadFileInfo::DownloadFileInfo(
OSExchangeData::DownloadFileInfo::~DownloadFileInfo() {}
+OSExchangeData::FileInfo::FileInfo(
+ const FilePath& path,
+ const FilePath& display_name)
+ : path(path),
+ display_name(display_name) {
+}
+
+OSExchangeData::FileInfo::~FileInfo() {}
+
OSExchangeData::OSExchangeData() : provider_(CreateProvider()) {
}
@@ -39,8 +48,9 @@ void OSExchangeData::SetFilename(const FilePath& path) {
provider_->SetFilename(path);
}
-void OSExchangeData::SetFilenames(const std::vector<FilePath>& paths) {
- provider_->SetFilenames(paths);
+void OSExchangeData::SetFilenames(
+ const std::vector<FileInfo>& filenames) {
+ provider_->SetFilenames(filenames);
}
void OSExchangeData::SetPickledData(CustomFormat format, const Pickle& data) {
@@ -59,8 +69,9 @@ bool OSExchangeData::GetFilename(FilePath* path) const {
return provider_->GetFilename(path);
}
-bool OSExchangeData::GetFilenames(std::vector<FilePath>* paths) const {
- return provider_->GetFilenames(paths);
+bool OSExchangeData::GetFilenames(
+ std::vector<FileInfo>* filenames) const {
+ return provider_->GetFilenames(filenames);
}
bool OSExchangeData::GetPickledData(CustomFormat format, Pickle* data) const {
diff --git a/ui/base/dragdrop/os_exchange_data.h b/ui/base/dragdrop/os_exchange_data.h
index 9ec452d..702a8ab 100644
--- a/ui/base/dragdrop/os_exchange_data.h
+++ b/ui/base/dragdrop/os_exchange_data.h
@@ -86,6 +86,17 @@ class UI_EXPORT OSExchangeData {
scoped_refptr<DownloadFileProvider> downloader;
};
+ // Encapsulates the info about a file.
+ struct UI_EXPORT FileInfo {
+ FileInfo(const FilePath& path, const FilePath& display_name);
+ ~FileInfo();
+
+ // The path of the file.
+ FilePath path;
+ // The display name of the file. This field is optional.
+ FilePath display_name;
+ };
+
// Provider defines the platform specific part of OSExchangeData that
// interacts with the native system.
class UI_EXPORT Provider {
@@ -96,13 +107,15 @@ class UI_EXPORT OSExchangeData {
virtual void SetString(const string16& data) = 0;
virtual void SetURL(const GURL& url, const string16& title) = 0;
virtual void SetFilename(const FilePath& path) = 0;
- virtual void SetFilenames(const std::vector<FilePath>& paths) = 0;
+ virtual void SetFilenames(
+ const std::vector<FileInfo>& file_names) = 0;
virtual void SetPickledData(CustomFormat format, const Pickle& data) = 0;
virtual bool GetString(string16* data) const = 0;
virtual bool GetURLAndTitle(GURL* url, string16* title) const = 0;
virtual bool GetFilename(FilePath* path) const = 0;
- virtual bool GetFilenames(std::vector<FilePath>* paths) const = 0;
+ virtual bool GetFilenames(
+ std::vector<FileInfo>* file_names) const = 0;
virtual bool GetPickledData(CustomFormat format, Pickle* data) const = 0;
virtual bool HasString() const = 0;
@@ -156,8 +169,9 @@ class UI_EXPORT OSExchangeData {
void SetURL(const GURL& url, const string16& title);
// A full path to a file.
void SetFilename(const FilePath& path);
- // Full path to one or more files.
- void SetFilenames(const std::vector<FilePath>& paths);
+ // Full path to one or more files. See also SetFilenames() in Provider.
+ void SetFilenames(
+ const std::vector<FileInfo>& file_names);
// Adds pickled data of the specified format.
void SetPickledData(CustomFormat format, const Pickle& data);
@@ -169,7 +183,8 @@ class UI_EXPORT OSExchangeData {
bool GetURLAndTitle(GURL* url, string16* title) const;
// Return the path of a file, if available.
bool GetFilename(FilePath* path) const;
- bool GetFilenames(std::vector<FilePath>* paths) const;
+ bool GetFilenames(
+ std::vector<FileInfo>* file_names) const;
bool GetPickledData(CustomFormat format, Pickle* data) const;
// Test whether or not data of certain types is present, without actually
diff --git a/ui/base/dragdrop/os_exchange_data_provider_aura.cc b/ui/base/dragdrop/os_exchange_data_provider_aura.cc
index be2570b..8d6e2fc 100644
--- a/ui/base/dragdrop/os_exchange_data_provider_aura.cc
+++ b/ui/base/dragdrop/os_exchange_data_provider_aura.cc
@@ -30,13 +30,13 @@ void OSExchangeDataProviderAura::SetURL(const GURL& url,
void OSExchangeDataProviderAura::SetFilename(const FilePath& path) {
filenames_.clear();
- filenames_.push_back(path);
+ filenames_.push_back(OSExchangeData::FileInfo(path, FilePath()));
formats_ |= OSExchangeData::FILE_NAME;
}
void OSExchangeDataProviderAura::SetFilenames(
- const std::vector<FilePath>& paths) {
- filenames_ = paths;
+ const std::vector<OSExchangeData::FileInfo>& filenames) {
+ filenames_ = filenames;
formats_ |= OSExchangeData::FILE_NAME;
}
@@ -73,15 +73,15 @@ bool OSExchangeDataProviderAura::GetFilename(FilePath* path) const {
if ((formats_ & OSExchangeData::FILE_NAME) == 0)
return false;
DCHECK(!filenames_.empty());
- *path = filenames_[0];
+ *path = filenames_[0].path;
return true;
}
bool OSExchangeDataProviderAura::GetFilenames(
- std::vector<FilePath>* paths) const {
+ std::vector<OSExchangeData::FileInfo>* filenames) const {
if ((formats_ & OSExchangeData::FILE_NAME) == 0)
return false;
- *paths = filenames_;
+ *filenames = filenames_;
return true;
}
diff --git a/ui/base/dragdrop/os_exchange_data_provider_aura.h b/ui/base/dragdrop/os_exchange_data_provider_aura.h
index ad5c312..0758a7a 100644
--- a/ui/base/dragdrop/os_exchange_data_provider_aura.h
+++ b/ui/base/dragdrop/os_exchange_data_provider_aura.h
@@ -29,13 +29,15 @@ class UI_EXPORT OSExchangeDataProviderAura : public OSExchangeData::Provider {
virtual void SetString(const string16& data) OVERRIDE;
virtual void SetURL(const GURL& url, const string16& title) OVERRIDE;
virtual void SetFilename(const FilePath& path) OVERRIDE;
- virtual void SetFilenames(const std::vector<FilePath>& paths) OVERRIDE;
+ virtual void SetFilenames(
+ const std::vector<OSExchangeData::FileInfo>& filenames) OVERRIDE;
virtual void SetPickledData(OSExchangeData::CustomFormat format,
const Pickle& data) OVERRIDE;
virtual bool GetString(string16* data) const OVERRIDE;
virtual bool GetURLAndTitle(GURL* url, string16* title) const OVERRIDE;
virtual bool GetFilename(FilePath* path) const OVERRIDE;
- virtual bool GetFilenames(std::vector<FilePath>* paths) const OVERRIDE;
+ virtual bool GetFilenames(
+ std::vector<OSExchangeData::FileInfo>* filenames) const OVERRIDE;
virtual bool GetPickledData(OSExchangeData::CustomFormat format,
Pickle* data) const OVERRIDE;
virtual bool HasString() const OVERRIDE;
@@ -83,7 +85,7 @@ class UI_EXPORT OSExchangeDataProviderAura : public OSExchangeData::Provider {
string16 title_;
// File name.
- std::vector<FilePath> filenames_;
+ std::vector<OSExchangeData::FileInfo> filenames_;
// PICKLED_DATA contents.
PickleData pickle_data_;
diff --git a/ui/base/dragdrop/os_exchange_data_provider_gtk.h b/ui/base/dragdrop/os_exchange_data_provider_gtk.h
index d336499..e43afbe 100644
--- a/ui/base/dragdrop/os_exchange_data_provider_gtk.h
+++ b/ui/base/dragdrop/os_exchange_data_provider_gtk.h
@@ -62,7 +62,8 @@ class UI_EXPORT OSExchangeDataProviderGtk : public OSExchangeData::Provider {
virtual void SetString(const string16& data) OVERRIDE;
virtual void SetURL(const GURL& url, const string16& title) OVERRIDE;
virtual void SetFilename(const FilePath& path) OVERRIDE;
- virtual void SetFilenames(const std::vector<FilePath>& path) OVERRIDE {
+ virtual void SetFilenames(
+ const std::vector<OSExchangeData::FileInfo>& filenames) OVERRIDE {
NOTREACHED();
}
virtual void SetPickledData(OSExchangeData::CustomFormat format,
@@ -70,7 +71,8 @@ class UI_EXPORT OSExchangeDataProviderGtk : public OSExchangeData::Provider {
virtual bool GetString(string16* data) const OVERRIDE;
virtual bool GetURLAndTitle(GURL* url, string16* title) const OVERRIDE;
virtual bool GetFilename(FilePath* path) const OVERRIDE;
- virtual bool GetFilenames(std::vector<FilePath>* paths) const OVERRIDE {
+ virtual bool GetFilenames(
+ std::vector<OSExchangeData::FileInfo>* filenames) const OVERRIDE {
NOTREACHED();
return false;
}
diff --git a/ui/base/dragdrop/os_exchange_data_provider_win.h b/ui/base/dragdrop/os_exchange_data_provider_win.h
index f48a70a..760719f 100644
--- a/ui/base/dragdrop/os_exchange_data_provider_win.h
+++ b/ui/base/dragdrop/os_exchange_data_provider_win.h
@@ -152,7 +152,8 @@ class UI_EXPORT OSExchangeDataProviderWin : public OSExchangeData::Provider {
virtual void SetString(const string16& data);
virtual void SetURL(const GURL& url, const string16& title);
virtual void SetFilename(const FilePath& path);
- virtual void SetFilenames(const std::vector<FilePath>& paths) {
+ virtual void SetFilenames(
+ const std::vector<OSExchangeData::FileInfo>& filenames) {
NOTREACHED();
}
virtual void SetPickledData(OSExchangeData::CustomFormat format,
@@ -164,7 +165,8 @@ class UI_EXPORT OSExchangeDataProviderWin : public OSExchangeData::Provider {
virtual bool GetString(string16* data) const;
virtual bool GetURLAndTitle(GURL* url, string16* title) const;
virtual bool GetFilename(FilePath* path) const;
- virtual bool GetFilenames(std::vector<FilePath>* paths) const {
+ virtual bool GetFilenames(
+ std::vector<OSExchangeData::FileInfo>* filenames) const {
NOTREACHED();
return false;
}
diff --git a/webkit/glue/webdropdata.cc b/webkit/glue/webdropdata.cc
index 02a0a94..5eb155c 100644
--- a/webkit/glue/webdropdata.cc
+++ b/webkit/glue/webdropdata.cc
@@ -21,6 +21,15 @@ using WebKit::WebDragData;
using WebKit::WebString;
using WebKit::WebVector;
+WebDropData::FileInfo::FileInfo() {
+}
+
+WebDropData::FileInfo::FileInfo(const string16& path,
+ const string16& display_name)
+ : path(path),
+ display_name(display_name) {
+}
+
WebDropData::WebDropData(const WebDragData& drag_data) {
const WebVector<WebDragData::Item>& item_list = drag_data.items();
for (size_t i = 0; i < item_list.size(); ++i) {
@@ -55,7 +64,8 @@ WebDropData::WebDropData(const WebDragData& drag_data) {
break;
case WebDragData::Item::StorageTypeFilename:
// TODO(varunjain): This only works on chromeos. Support win/mac/gtk.
- filenames.push_back(item.filenameData);
+ filenames.push_back(FileInfo(item.filenameData,
+ item.displayNameData));
break;
}
}
@@ -102,12 +112,12 @@ WebDragData WebDropData::ToDragData() const {
item_list.push_back(item);
}
- for (std::vector<string16>::const_iterator it = filenames.begin();
- it != filenames.end();
- ++it) {
+ for (std::vector<FileInfo>::const_iterator it =
+ filenames.begin(); it != filenames.end(); ++it) {
WebDragData::Item item;
item.storageType = WebDragData::Item::StorageTypeFilename;
- item.filenameData = *it;
+ item.filenameData = it->path;
+ item.displayNameData = it->display_name;
item_list.push_back(item);
}
diff --git a/webkit/glue/webdropdata.h b/webkit/glue/webdropdata.h
index 14387b3..6b17c6a 100644
--- a/webkit/glue/webdropdata.h
+++ b/webkit/glue/webdropdata.h
@@ -24,6 +24,17 @@ class WebDragData;
}
struct WEBKIT_GLUE_EXPORT WebDropData {
+ // The struct is used to represent a file in the drop data.
+ struct WEBKIT_GLUE_EXPORT FileInfo {
+ FileInfo();
+ FileInfo(const string16& path, const string16& display_name);
+
+ // The path of the file.
+ string16 path;
+ // The display name of the file. This field is optional.
+ string16 display_name;
+ };
+
// Construct from a WebDragData object.
explicit WebDropData(const WebKit::WebDragData&);
@@ -39,7 +50,7 @@ struct WEBKIT_GLUE_EXPORT WebDropData {
string16 download_metadata;
// User is dropping one or more files on the webview.
- std::vector<string16> filenames;
+ std::vector<FileInfo> filenames;
// Isolated filesystem ID for the files being dragged on the webview.
string16 filesystem_id;
diff --git a/webkit/glue/webdropdata_win.cc b/webkit/glue/webdropdata_win.cc
index d0b3016..049df9e 100644
--- a/webkit/glue/webdropdata_win.cc
+++ b/webkit/glue/webdropdata_win.cc
@@ -21,7 +21,10 @@ void WebDropData::PopulateWebDropData(IDataObject* data_object,
if (test_url.is_valid())
drop_data->url = test_url;
}
- ui::ClipboardUtil::GetFilenames(data_object, &drop_data->filenames);
+ std::vector<string16> filenames;
+ ui::ClipboardUtil::GetFilenames(data_object, &filenames);
+ for (size_t i = 0; i < filenames.size(); ++i)
+ drop_data->filenames.push_back(FileInfo(filenames[i], string16()));
ui::ClipboardUtil::GetPlainText(data_object, &drop_data->plain_text);
std::string base_url;
ui::ClipboardUtil::GetHtml(data_object, &drop_data->text_html, &base_url);