diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-24 23:23:52 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-24 23:23:52 +0000 |
commit | 9ec8771f15b2e73ae132b294f86ef74d36034408 (patch) | |
tree | 1e96e9752d03fc48d61211519523023ff3b59cd0 /webkit/plugins/npapi | |
parent | 98f60edd0302dba3ccff439fb9e799e377248c93 (diff) | |
download | chromium_src-9ec8771f15b2e73ae132b294f86ef74d36034408.zip chromium_src-9ec8771f15b2e73ae132b294f86ef74d36034408.tar.gz chromium_src-9ec8771f15b2e73ae132b294f86ef74d36034408.tar.bz2 |
Get rid of the dependency on WebKit::WebCursorInfo internals from WebCursor.
This will help ensure that we don't have to depend on WebKit when we use the WebCursor
class. The current consumers of this class are plugins and browser.
We still have a dependency on the WebCursorInfo::Type enum which is fine.
Added helper functions InitializeCursorFromWebKitCursorInfo and GetWebKitCursorInfo to the webkit_glue
namespace in the newly added cursor_utils.cc/.h files which live in webkit_glue. These functions adapt
WebCursorInfo to our WebCursor and vice versa.
With this change we can move the WebCursor class to webkit\common in a subsequent CL.
BUG=237249
TBR=jamesr@chromium.org
Review URL: https://codereview.chromium.org/15946004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202220 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/npapi')
-rw-r--r-- | webkit/plugins/npapi/webplugin_delegate.h | 4 | ||||
-rw-r--r-- | webkit/plugins/npapi/webplugin_delegate_impl.cc | 5 | ||||
-rw-r--r-- | webkit/plugins/npapi/webplugin_delegate_impl.h | 4 | ||||
-rw-r--r-- | webkit/plugins/npapi/webplugin_delegate_impl_android.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/npapi/webplugin_delegate_impl_aura.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/npapi/webplugin_delegate_impl_mac.mm | 4 | ||||
-rw-r--r-- | webkit/plugins/npapi/webplugin_delegate_impl_win.cc | 4 | ||||
-rw-r--r-- | webkit/plugins/npapi/webplugin_impl.cc | 11 |
9 files changed, 27 insertions, 17 deletions
diff --git a/webkit/plugins/npapi/webplugin_delegate.h b/webkit/plugins/npapi/webplugin_delegate.h index 4c0eb42..43a3955 100644 --- a/webkit/plugins/npapi/webplugin_delegate.h +++ b/webkit/plugins/npapi/webplugin_delegate.h @@ -13,6 +13,7 @@ #include "third_party/WebKit/Source/Platform/chromium/public/WebCanvas.h" #include "third_party/npapi/bindings/npapi.h" #include "ui/gfx/native_widget_types.h" +#include "webkit/glue/webcursor.h" #include "webkit/plugins/webkit_plugins_export.h" class GURL; @@ -20,7 +21,6 @@ struct NPObject; namespace WebKit { class WebInputEvent; -struct WebCursorInfo; } namespace gfx { @@ -78,7 +78,7 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegate { // Returns whether the event was handled. This is only called in windowsless // mode. See NPAPI NPP_HandleEvent for more information. virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, - WebKit::WebCursorInfo* cursor) = 0; + WebCursor::CursorInfo* cursor) = 0; // Gets the NPObject associated with the plugin for scripting. virtual NPObject* GetPluginScriptableObject() = 0; diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.cc b/webkit/plugins/npapi/webplugin_delegate_impl.cc index a27fc9f..3c2587e9 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl.cc +++ b/webkit/plugins/npapi/webplugin_delegate_impl.cc @@ -254,8 +254,9 @@ void WebPluginDelegateImpl::WindowedUpdateGeometry( } } -bool WebPluginDelegateImpl::HandleInputEvent(const WebInputEvent& event, - WebCursorInfo* cursor_info) { +bool WebPluginDelegateImpl::HandleInputEvent( + const WebInputEvent& event, + WebCursor::CursorInfo* cursor_info) { DCHECK(windowless_) << "events should only be received in windowless mode"; bool pop_user_gesture = false; diff --git a/webkit/plugins/npapi/webplugin_delegate_impl.h b/webkit/plugins/npapi/webplugin_delegate_impl.h index 7afc9de..6755891 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl.h +++ b/webkit/plugins/npapi/webplugin_delegate_impl.h @@ -110,7 +110,7 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect) OVERRIDE; virtual void SetFocus(bool focused) OVERRIDE; virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, - WebKit::WebCursorInfo* cursor_info) OVERRIDE; + WebCursor::CursorInfo* cursor_info) OVERRIDE; virtual NPObject* GetPluginScriptableObject() OVERRIDE; virtual bool GetFormValue(base::string16* value) OVERRIDE; virtual void DidFinishLoadWithReason(const GURL& url, @@ -286,7 +286,7 @@ class WEBKIT_PLUGINS_EXPORT WebPluginDelegateImpl : public WebPluginDelegate { // Does platform-specific event handling. Arguments and return are identical // to HandleInputEvent. bool PlatformHandleInputEvent(const WebKit::WebInputEvent& event, - WebKit::WebCursorInfo* cursor_info); + WebCursor::CursorInfo* cursor_info); // Closes down and destroys our plugin instance. void DestroyInstance(); diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_android.cc b/webkit/plugins/npapi/webplugin_delegate_impl_android.cc index 5e32cb4..12e524f 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_android.cc +++ b/webkit/plugins/npapi/webplugin_delegate_impl_android.cc @@ -6,10 +6,10 @@ #include "base/basictypes.h" #include "base/logging.h" +#include "webkit/glue/webcursor.h" #include "webkit/plugins/npapi/plugin_instance.h" #include "webkit/plugins/npapi/webplugin.h" -using WebKit::WebCursorInfo; using WebKit::WebInputEvent; namespace webkit { @@ -73,7 +73,7 @@ bool WebPluginDelegateImpl::PlatformSetPluginHasFocus(bool focused) { } bool WebPluginDelegateImpl::PlatformHandleInputEvent( - const WebInputEvent& event, WebCursorInfo* cursor_info) { + const WebInputEvent& event, WebCursor::CursorInfo* cursor_info) { return false; } diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_aura.cc b/webkit/plugins/npapi/webplugin_delegate_impl_aura.cc index ba91bf9..aa712cc 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_aura.cc +++ b/webkit/plugins/npapi/webplugin_delegate_impl_aura.cc @@ -4,9 +4,9 @@ #include "webkit/plugins/npapi/webplugin_delegate_impl.h" +#include "webkit/glue/webcursor.h" #include "webkit/plugins/npapi/plugin_instance.h" -using WebKit::WebCursorInfo; using WebKit::WebInputEvent; namespace webkit { @@ -60,7 +60,7 @@ bool WebPluginDelegateImpl::PlatformSetPluginHasFocus(bool focused) { } bool WebPluginDelegateImpl::PlatformHandleInputEvent( - const WebInputEvent& event, WebCursorInfo* cursor_info) { + const WebInputEvent& event, WebCursor::CursorInfo* cursor_info) { return false; } diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc b/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc index 99d5078..a61cb2a 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc +++ b/webkit/plugins/npapi/webplugin_delegate_impl_gtk.cc @@ -15,13 +15,13 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "ui/base/gtk/gtk_compat.h" #include "ui/gfx/blit.h" +#include "webkit/glue/webcursor.h" #include "webkit/plugins/npapi/plugin_instance.h" #include "webkit/plugins/npapi/webplugin.h" #include "webkit/plugins/plugin_constants.h" #include "third_party/npapi/bindings/npapi_x11.h" -using WebKit::WebCursorInfo; using WebKit::WebKeyboardEvent; using WebKit::WebInputEvent; using WebKit::WebMouseEvent; @@ -714,7 +714,7 @@ static bool NPEventFromWebInputEvent(const WebInputEvent& event, } bool WebPluginDelegateImpl::PlatformHandleInputEvent( - const WebInputEvent& event, WebCursorInfo* cursor_info) { + const WebInputEvent& event, WebCursor::CursorInfo* cursor_info) { if (first_event_time_ < 0.0) first_event_time_ = event.timeStampSeconds; diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm index 01c8a57..8c5efbd 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm +++ b/webkit/plugins/npapi/webplugin_delegate_impl_mac.mm @@ -20,13 +20,13 @@ #include "skia/ext/skia_utils_mac.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" +#include "webkit/glue/webcursor.h" #include "webkit/plugins/npapi/plugin_instance.h" #include "webkit/plugins/npapi/plugin_lib.h" #include "webkit/plugins/npapi/plugin_web_event_converter_mac.h" #include "webkit/plugins/npapi/webplugin.h" #include "webkit/plugins/npapi/webplugin_accelerated_surface_mac.h" -using WebKit::WebCursorInfo; using WebKit::WebKeyboardEvent; using WebKit::WebInputEvent; using WebKit::WebMouseEvent; @@ -289,7 +289,7 @@ void WebPluginDelegateImpl::CGPaint(CGContextRef context, } bool WebPluginDelegateImpl::PlatformHandleInputEvent( - const WebInputEvent& event, WebCursorInfo* cursor_info) { + const WebInputEvent& event, WebCursor::CursorInfo* cursor_info) { DCHECK(cursor_info != NULL); // If an event comes in before the plugin has been set up, bail. diff --git a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc index dca3cc4..2ee3e77 100644 --- a/webkit/plugins/npapi/webplugin_delegate_impl_win.cc +++ b/webkit/plugins/npapi/webplugin_delegate_impl_win.cc @@ -24,6 +24,7 @@ #include "skia/ext/platform_canvas.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "ui/base/win/hwnd_util.h" +#include "webkit/glue/webcursor.h" #include "webkit/plugins/npapi/plugin_constants_win.h" #include "webkit/plugins/npapi/plugin_instance.h" #include "webkit/plugins/npapi/plugin_lib.h" @@ -34,7 +35,6 @@ #include "webkit/plugins/npapi/webplugin_ime_win.h" #include "webkit/plugins/plugin_constants.h" -using WebKit::WebCursorInfo; using WebKit::WebKeyboardEvent; using WebKit::WebInputEvent; using WebKit::WebMouseEvent; @@ -1272,7 +1272,7 @@ static bool NPEventFromWebInputEvent(const WebInputEvent& event, } bool WebPluginDelegateImpl::PlatformHandleInputEvent( - const WebInputEvent& event, WebCursorInfo* cursor_info) { + const WebInputEvent& event, WebCursor::CursorInfo* cursor_info) { DCHECK(cursor_info != NULL); NPEvent np_event; diff --git a/webkit/plugins/npapi/webplugin_impl.cc b/webkit/plugins/npapi/webplugin_impl.cc index bbbf0dc..801ca91 100644 --- a/webkit/plugins/npapi/webplugin_impl.cc +++ b/webkit/plugins/npapi/webplugin_impl.cc @@ -402,7 +402,16 @@ bool WebPluginImpl::handleInputEvent( if (event.type == WebInputEvent::ContextMenu) return true; - return delegate_->HandleInputEvent(event, &cursor_info); + WebCursor::CursorInfo web_cursor_info; + bool ret = delegate_->HandleInputEvent(event, &web_cursor_info); + cursor_info.type = web_cursor_info.type; + cursor_info.hotSpot = web_cursor_info.hotspot; + cursor_info.customImage = web_cursor_info.custom_image; + cursor_info.imageScaleFactor = web_cursor_info.image_scale_factor; +#if defined(OS_WIN) + cursor_info.externalHandle = web_cursor_info.external_handle; +#endif + return ret; } void WebPluginImpl::didReceiveResponse(const WebURLResponse& response) { |