diff options
author | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-08 23:50:54 +0000 |
---|---|---|
committer | dcheng@chromium.org <dcheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-08 23:50:54 +0000 |
commit | c5c86ad1471abfa6b080756aa5258815781c57d5 (patch) | |
tree | bbd7709ca49e392c2d4547e393a067f560f45122 | |
parent | c3c3695c47cc541ea9de089bdaa6f6a05f062535 (diff) | |
download | chromium_src-c5c86ad1471abfa6b080756aa5258815781c57d5.zip chromium_src-c5c86ad1471abfa6b080756aa5258815781c57d5.tar.gz chromium_src-c5c86ad1471abfa6b080756aa5258815781c57d5.tar.bz2 |
Implement Clipboard::ReadAvailableTypes for Mac.
BUG=75237
TEST=Local testing.
Review URL: http://codereview.chromium.org/6823019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@81015 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ui/base/clipboard/clipboard.cc | 4 | ||||
-rw-r--r-- | ui/base/clipboard/clipboard.h | 5 | ||||
-rw-r--r-- | ui/base/clipboard/clipboard_mac.mm | 7 |
3 files changed, 15 insertions, 1 deletions
diff --git a/ui/base/clipboard/clipboard.cc b/ui/base/clipboard/clipboard.cc index f16bb92..c8389da 100644 --- a/ui/base/clipboard/clipboard.cc +++ b/ui/base/clipboard/clipboard.cc @@ -74,6 +74,10 @@ bool ValidateAndMapSharedBitmap(const Clipboard::ObjectMapParams& params, } // namespace +const char Clipboard::kMimeTypeText[] = "text/plain"; +const char Clipboard::kMimeTypeHTML[] = "text/html"; +const char Clipboard::kMimeTypePNG[] = "image/png"; + void Clipboard::DispatchObject(ObjectType type, const ObjectMapParams& params) { // All types apart from CBF_WEBKIT need at least 1 non-empty param. if (type != CBF_WEBKIT && (params.empty() || params[0].empty())) diff --git a/ui/base/clipboard/clipboard.h b/ui/base/clipboard/clipboard.h index 2d040c8..bc8b950 100644 --- a/ui/base/clipboard/clipboard.h +++ b/ui/base/clipboard/clipboard.h @@ -275,6 +275,11 @@ class Clipboard { GtkClipboard* primary_selection_; #endif + // MIME type constants. + static const char kMimeTypeText[]; + static const char kMimeTypeHTML[]; + static const char kMimeTypePNG[]; + DISALLOW_COPY_AND_ASSIGN(Clipboard); }; diff --git a/ui/base/clipboard/clipboard_mac.mm b/ui/base/clipboard/clipboard_mac.mm index e9dff9b..74b73f9 100644 --- a/ui/base/clipboard/clipboard_mac.mm +++ b/ui/base/clipboard/clipboard_mac.mm @@ -185,8 +185,13 @@ void Clipboard::ReadAvailableTypes(Clipboard::Buffer buffer, return; } - // TODO(dcheng): Implement me. types->clear(); + if (IsFormatAvailable(Clipboard::GetPlainTextFormatType(), buffer)) + types->push_back(UTF8ToUTF16(kMimeTypeText)); + if (IsFormatAvailable(Clipboard::GetHtmlFormatType(), buffer)) + types->push_back(UTF8ToUTF16(kMimeTypeHTML)); + if ([NSImage canInitWithPasteboard:GetPasteboard()]) + types->push_back(UTF8ToUTF16(kMimeTypePNG)); *contains_filenames = false; } |