diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-24 17:51:24 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-24 17:51:24 +0000 |
commit | d5fa6fd614049dcacb22ab9034eaf2b892a17e85 (patch) | |
tree | 6da9ddda91bee81477b131b2636c6b8ce5f5200d /chrome/renderer | |
parent | 24096e8d585d543982cea6137ee9eeee63f5d13a (diff) | |
download | chromium_src-d5fa6fd614049dcacb22ab9034eaf2b892a17e85.zip chromium_src-d5fa6fd614049dcacb22ab9034eaf2b892a17e85.tar.gz chromium_src-d5fa6fd614049dcacb22ab9034eaf2b892a17e85.tar.bz2 |
Add a SetCursor API to Pepper. I'll implement custom cursors once we switched over to the new API.
Review URL: http://codereview.chromium.org/2122018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer')
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.cc | 64 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_pepper.h | 3 |
2 files changed, 66 insertions, 1 deletions
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 54f7ff5..7b82204 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -35,6 +35,7 @@ #endif #include "third_party/npapi/bindings/npapi_extensions.h" #include "third_party/npapi/bindings/npapi_extensions_private.h" +#include "third_party/WebKit/WebKit/chromium/public/WebCursorInfo.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" #include "webkit/glue/plugins/plugin_constants_win.h" #include "webkit/glue/plugins/plugin_instance.h" @@ -366,6 +367,64 @@ NPWidgetExtensions* WebPluginDelegatePepper::GetWidgetExtensions() { return PepperWidget::GetWidgetExtensions(); } +#define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, np_name) \ + COMPILE_ASSERT(int(WebCursorInfo::webkit_name) == int(np_name), \ + mismatching_enums) + +COMPILE_ASSERT_MATCHING_ENUM(TypePointer, NPCursorTypePointer); +COMPILE_ASSERT_MATCHING_ENUM(TypeCross, NPCursorTypeCross); +COMPILE_ASSERT_MATCHING_ENUM(TypeHand, NPCursorTypeHand); +COMPILE_ASSERT_MATCHING_ENUM(TypeIBeam, NPCursorTypeIBeam); +COMPILE_ASSERT_MATCHING_ENUM(TypeWait, NPCursorTypeWait); +COMPILE_ASSERT_MATCHING_ENUM(TypeHelp, NPCursorTypeHelp); +COMPILE_ASSERT_MATCHING_ENUM(TypeEastResize, NPCursorTypeEastResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeNorthResize, NPCursorTypeNorthResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeNorthEastResize, NPCursorTypeNorthEastResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeNorthWestResize, NPCursorTypeNorthWestResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeSouthResize, NPCursorTypeSouthResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeSouthEastResize, NPCursorTypeSouthEastResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeSouthWestResize, NPCursorTypeSouthWestResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeWestResize, NPCursorTypeWestResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeNorthSouthResize, + NPCursorTypeNorthSouthResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeEastWestResize, NPCursorTypeEastWestResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeNorthEastSouthWestResize, + NPCursorTypeNorthEastSouthWestResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeNorthWestSouthEastResize, + NPCursorTypeNorthWestSouthEastResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeColumnResize, NPCursorTypeColumnResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeRowResize, NPCursorTypeRowResize); +COMPILE_ASSERT_MATCHING_ENUM(TypeMiddlePanning, NPCursorTypeMiddlePanning); +COMPILE_ASSERT_MATCHING_ENUM(TypeEastPanning, NPCursorTypeEastPanning); +COMPILE_ASSERT_MATCHING_ENUM(TypeNorthPanning, NPCursorTypeNorthPanning); +COMPILE_ASSERT_MATCHING_ENUM(TypeNorthEastPanning, + NPCursorTypeNorthEastPanning); +COMPILE_ASSERT_MATCHING_ENUM(TypeNorthWestPanning, + NPCursorTypeNorthWestPanning); +COMPILE_ASSERT_MATCHING_ENUM(TypeSouthPanning, NPCursorTypeSouthPanning); +COMPILE_ASSERT_MATCHING_ENUM(TypeSouthEastPanning, + NPCursorTypeSouthEastPanning); +COMPILE_ASSERT_MATCHING_ENUM(TypeSouthWestPanning, + NPCursorTypeSouthWestPanning); +COMPILE_ASSERT_MATCHING_ENUM(TypeWestPanning, NPCursorTypeWestPanning); +COMPILE_ASSERT_MATCHING_ENUM(TypeMove, NPCursorTypeMove); +COMPILE_ASSERT_MATCHING_ENUM(TypeVerticalText, NPCursorTypeVerticalText); +COMPILE_ASSERT_MATCHING_ENUM(TypeCell, NPCursorTypeCell); +COMPILE_ASSERT_MATCHING_ENUM(TypeContextMenu, NPCursorTypeContextMenu); +COMPILE_ASSERT_MATCHING_ENUM(TypeAlias, NPCursorTypeAlias); +COMPILE_ASSERT_MATCHING_ENUM(TypeProgress, NPCursorTypeProgress); +COMPILE_ASSERT_MATCHING_ENUM(TypeNoDrop, NPCursorTypeNoDrop); +COMPILE_ASSERT_MATCHING_ENUM(TypeCopy, NPCursorTypeCopy); +COMPILE_ASSERT_MATCHING_ENUM(TypeNone, NPCursorTypeNone); +COMPILE_ASSERT_MATCHING_ENUM(TypeNotAllowed, NPCursorTypeNotAllowed); +COMPILE_ASSERT_MATCHING_ENUM(TypeZoomIn, NPCursorTypeZoomIn); +COMPILE_ASSERT_MATCHING_ENUM(TypeZoomOut, NPCursorTypeZoomOut); + +bool WebPluginDelegatePepper::SetCursor(NPCursorType type) { + cursor_.reset(new WebCursorInfo(static_cast<WebCursorInfo::Type>(type))); + return true; +} + void WebPluginDelegatePepper::Zoom(int factor) { NPPExtensions* extensions = NULL; instance()->NPP_GetValue(NPPVPepperExtensions, &extensions); @@ -1310,7 +1369,10 @@ bool WebPluginDelegatePepper::HandleInputEvent(const WebInputEvent& event, // NOTIMPLEMENTED(); break; } - return instance()->NPP_HandleEvent(&npevent) != 0; + bool rv = instance()->NPP_HandleEvent(&npevent) != 0; + if (cursor_.get()) + *cursor_info = *cursor_; + return rv; } #if defined(ENABLE_GPU) diff --git a/chrome/renderer/webplugin_delegate_pepper.h b/chrome/renderer/webplugin_delegate_pepper.h index 7f861fc..92287bc 100644 --- a/chrome/renderer/webplugin_delegate_pepper.h +++ b/chrome/renderer/webplugin_delegate_pepper.h @@ -93,6 +93,7 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate, NPChooseFileCallback callback, void* user_data); virtual NPWidgetExtensions* GetWidgetExtensions(); + virtual bool SetCursor(NPCursorType type); virtual void Zoom(int factor); @@ -301,6 +302,8 @@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate, NPChooseFileCallback current_choose_file_callback_; void* current_choose_file_user_data_; + scoped_ptr<WebKit::WebCursorInfo> cursor_; + DISALLOW_COPY_AND_ASSIGN(WebPluginDelegatePepper); }; |