Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(200)

Unified Diff: ppapi/proxy/ppb_flash_clipboard_proxy.cc

Issue 6724010: Pepper/Flapper: Add IsFormatAvailable() to PPB_Flash_Clipboard. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/ppb_flash_clipboard_proxy.h ('k') | webkit/glue/webclipboard_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_flash_clipboard_proxy.cc
diff --git a/ppapi/proxy/ppb_flash_clipboard_proxy.cc b/ppapi/proxy/ppb_flash_clipboard_proxy.cc
index a8490716c3dece5bf9c96d246db9bc490297b716..efe1df3665c82e29f3e8629d72a5426af1ef2923 100644
--- a/ppapi/proxy/ppb_flash_clipboard_proxy.cc
+++ b/ppapi/proxy/ppb_flash_clipboard_proxy.cc
@@ -21,6 +21,32 @@ bool IsValidClipboardType(PP_Flash_Clipboard_Type clipboard_type) {
clipboard_type == PP_FLASH_CLIPBOARD_TYPE_DRAG;
}
+bool IsValidClipboardFormat(PP_Flash_Clipboard_Format format) {
+ // Purposely excludes |PP_FLASH_CLIPBOARD_FORMAT_INVALID|.
+ return format == PP_FLASH_CLIPBOARD_FORMAT_PLAINTEXT ||
+ format == PP_FLASH_CLIPBOARD_FORMAT_HTML;
+}
+
+PP_Bool IsFormatAvailable(PP_Instance instance_id,
+ PP_Flash_Clipboard_Type clipboard_type,
+ PP_Flash_Clipboard_Format format) {
+ PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
+ if (!dispatcher)
+ return PP_FALSE;
+
+ if (!IsValidClipboardType(clipboard_type) || !IsValidClipboardFormat(format))
+ return PP_FALSE;
+
+ bool result = false;
+ dispatcher->Send(new PpapiHostMsg_PPBFlashClipboard_IsFormatAvailable(
+ INTERFACE_ID_PPB_FLASH_CLIPBOARD,
+ instance_id,
+ static_cast<int>(clipboard_type),
+ static_cast<int>(format),
+ &result));
+ return BoolToPPBool(result);
+}
+
PP_Var ReadPlainText(PP_Instance instance_id,
PP_Flash_Clipboard_Type clipboard_type) {
PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance_id);
@@ -57,6 +83,7 @@ int32_t WritePlainText(PP_Instance instance_id,
}
const PPB_Flash_Clipboard flash_clipboard_interface = {
+ &IsFormatAvailable,
&ReadPlainText,
&WritePlainText
};
@@ -91,6 +118,8 @@ const InterfaceProxy::Info* PPB_Flash_Clipboard_Proxy::GetInfo() {
bool PPB_Flash_Clipboard_Proxy::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PPB_Flash_Clipboard_Proxy, msg)
+ IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlashClipboard_IsFormatAvailable,
+ OnMsgIsFormatAvailable)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlashClipboard_ReadPlainText,
OnMsgReadPlainText)
IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBFlashClipboard_WritePlainText,
@@ -100,6 +129,17 @@ bool PPB_Flash_Clipboard_Proxy::OnMessageReceived(const IPC::Message& msg) {
return handled;
}
+void PPB_Flash_Clipboard_Proxy::OnMsgIsFormatAvailable(
+ PP_Instance instance_id,
+ int clipboard_type,
+ int format,
+ bool* result) {
+ *result = PPBoolToBool(ppb_flash_clipboard_target()->IsFormatAvailable(
+ instance_id,
+ static_cast<PP_Flash_Clipboard_Type>(clipboard_type),
+ static_cast<PP_Flash_Clipboard_Format>(format)));
+}
+
void PPB_Flash_Clipboard_Proxy::OnMsgReadPlainText(
PP_Instance instance_id,
int clipboard_type,
« no previous file with comments | « ppapi/proxy/ppb_flash_clipboard_proxy.h ('k') | webkit/glue/webclipboard_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698