summaryrefslogtreecommitdiffstats
path: root/ui/base/clipboard
diff options
context:
space:
mode:
Diffstat (limited to 'ui/base/clipboard')
-rw-r--r--ui/base/clipboard/clipboard.cc4
-rw-r--r--ui/base/clipboard/clipboard.h5
-rw-r--r--ui/base/clipboard/clipboard_mac.mm7
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;
}