diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-29 23:36:13 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-29 23:36:13 +0000 |
commit | be61b42e45eb49e26789aaa4bb74763a61b26593 (patch) | |
tree | ec1f5847261b531913ecb7a4b3c8920d81a88d0d /base | |
parent | 00c2ecbccaf81b313c9f2a74354012452db65642 (diff) | |
download | chromium_src-be61b42e45eb49e26789aaa4bb74763a61b26593.zip chromium_src-be61b42e45eb49e26789aaa4bb74763a61b26593.tar.gz chromium_src-be61b42e45eb49e26789aaa4bb74763a61b26593.tar.bz2 |
More web contents dragging.
TEST=drag an image (such as the google logo from google.com) into gimp or onto the desktop.
BUG=http://crbug.com/15429
Review URL: http://codereview.chromium.org/151033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19553 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/mime_util.h | 3 | ||||
-rw-r--r-- | base/mime_util_linux.cc | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/base/mime_util.h b/base/mime_util.h index 47c5975..4b67e46 100644 --- a/base/mime_util.h +++ b/base/mime_util.h @@ -17,6 +17,9 @@ namespace mime_util { // If the mime type is unknown, this will return application/octet-stream. std::string GetFileMimeType(const FilePath& filepath); +// Get the mime type for a byte vector. +std::string GetDataMimeType(const std::string& data); + // Gets the file name for an icon given the mime type and icon pixel size. // Where an icon is a square image of |size| x |size|. // This will try to find the closest matching icon. If that's not available, diff --git a/base/mime_util_linux.cc b/base/mime_util_linux.cc index 39eab03..12dff7a 100644 --- a/base/mime_util_linux.cc +++ b/base/mime_util_linux.cc @@ -561,6 +561,10 @@ std::string GetFileMimeType(const FilePath& filepath) { return xdg_mime_get_mime_type_from_file_name(filepath.value().c_str()); } +std::string GetDataMimeType(const std::string& data) { + return xdg_mime_get_mime_type_for_data(data.data(), data.length(), NULL); +} + FilePath GetMimeIcon(const std::string& mime_type, size_t size) { std::vector<std::string> icon_names; std::string icon_name; |