diff options
-rw-r--r-- | third_party/npapi/bindings/npapi_extensions.h | 7 | ||||
-rw-r--r-- | webkit/glue/plugins/npapi_extension_thunk.cc | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/third_party/npapi/bindings/npapi_extensions.h b/third_party/npapi/bindings/npapi_extensions.h index 011628e..2e18a6a 100644 --- a/third_party/npapi/bindings/npapi_extensions.h +++ b/third_party/npapi/bindings/npapi_extensions.h @@ -116,10 +116,17 @@ typedef NPDevice* (*NPAcquireDevicePtr)( NPP instance, NPDeviceID device); +/* Copy UTF-8 string into clipboard */ +typedef void (*NPCopyTextToClipboardPtr)( + NPP instance, + const char* content); + /* Pepper extensions */ struct NPExtensions { /* Device interface acquisition */ NPAcquireDevicePtr acquireDevice; + /* Clipboard functionality */ + NPCopyTextToClipboardPtr copyTextToClipboard; }; /* Events -------------------------------------------------------------------*/ diff --git a/webkit/glue/plugins/npapi_extension_thunk.cc b/webkit/glue/plugins/npapi_extension_thunk.cc index 61054c7..ab5b852 100644 --- a/webkit/glue/plugins/npapi_extension_thunk.cc +++ b/webkit/glue/plugins/npapi_extension_thunk.cc @@ -5,8 +5,11 @@ #include "webkit/glue/plugins/npapi_extension_thunk.h" #include "base/logging.h" +#include "base/utf_string_conversions.h" #include "third_party/npapi/bindings/npapi_extensions.h" #include "webkit/glue/plugins/plugin_instance.h" +#include "webkit/glue/scoped_clipboard_writer_glue.h" +#include "webkit/glue/webkit_glue.h" #include "webkit/glue/webplugin.h" #include "webkit/glue/webplugin_delegate.h" @@ -374,11 +377,17 @@ static NPDevice* AcquireDevice(NPP id, NPDeviceID device_id) { } } +static void CopyTextToClipboard(NPP id, const char* content) { + ScopedClipboardWriterGlue scw(webkit_glue::ClipboardGetClipboard()); + scw.WriteText(UTF8ToUTF16(content)); +} + namespace NPAPI { NPError GetPepperExtensionsFunctions(void* value) { static const NPExtensions kExtensions = { &AcquireDevice, + &CopyTextToClipboard, }; // Return a pointer to the canonical function table. |