diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-27 22:59:20 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-27 22:59:20 +0000 |
commit | 6f496b2703a7ccb7bba1dbb14a2b9c00f02a853e (patch) | |
tree | 77586da8fc9d5dd3051b889a2f89d8e651924adc /chrome/renderer/webplugin_delegate_pepper.cc | |
parent | 0572d4f6ead89fd19176d0c8346ef1a281458073 (diff) | |
download | chromium_src-6f496b2703a7ccb7bba1dbb14a2b9c00f02a853e.zip chromium_src-6f496b2703a7ccb7bba1dbb14a2b9c00f02a853e.tar.gz chromium_src-6f496b2703a7ccb7bba1dbb14a2b9c00f02a853e.tar.bz2 |
Add a "Copy" API to Pepper, so that plugins don't have to hardcode the platform specific shortcut. Also, this makes copying through the page menu work on Mac and Linux.
Review URL: http://codereview.chromium.org/2329001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48443 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/webplugin_delegate_pepper.cc')
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index d70608f..a2b229c 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -10,6 +10,7 @@ #include <vector> #include "base/file_util.h" +#include "base/keyboard_codes.h" #if defined(OS_MACOSX) #include "base/mac_util.h" #endif @@ -432,6 +433,13 @@ void WebPluginDelegatePepper::Zoom(int factor) { extensions->zoom(instance()->npp(), factor); } +void WebPluginDelegatePepper::Copy() { + NPPExtensions* extensions = NULL; + instance()->NPP_GetValue(NPPVPepperExtensions, &extensions); + if (extensions && extensions->copy) + extensions->copy(instance()->npp()); +} + NPError WebPluginDelegatePepper::Device2DQueryCapability(int32 capability, int32* value) { return NPERR_GENERIC_ERROR; @@ -1337,6 +1345,20 @@ void BuildMouseWheelEvent(const WebInputEvent* event, NPPepperEvent* npevent) { bool WebPluginDelegatePepper::HandleInputEvent(const WebInputEvent& event, WebCursorInfo* cursor_info) { + if (event.type == WebInputEvent::KeyDown) { + const WebKeyboardEvent* key_event = + reinterpret_cast<const WebKeyboardEvent*>(&event); +#if defined(OS_MACOSX) + if (key_event->modifiers == NPEventModifier_MetaKey && +#else + if (key_event->modifiers == NPEventModifier_ControlKey && +#endif + key_event->windowsKeyCode == base::VKEY_C) { + Copy(); + return true; + } + } + NPPepperEvent npevent; npevent.type = ConvertEventTypes(event.type); |