summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-15 21:51:19 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-15 21:51:19 +0000
commit997a47ac989abd294e94f8384f1eba6ad5698ad2 (patch)
tree5e1b92105eb5f52626c583953ed7204584e37885 /webkit/glue
parentfa1cf0b87092ed3f3069a8549270f999e05cca20 (diff)
downloadchromium_src-997a47ac989abd294e94f8384f1eba6ad5698ad2.zip
chromium_src-997a47ac989abd294e94f8384f1eba6ad5698ad2.tar.gz
chromium_src-997a47ac989abd294e94f8384f1eba6ad5698ad2.tar.bz2
(Mac) Intercept (Carbon) cursor setting by plugins and forward it on properly.
BUG=http://crbug.com/20717 TEST=as in bug; this covers old Flash Review URL: http://codereview.chromium.org/550062 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36416 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/plugins/fake_plugin_window_tracker_mac.cc7
-rw-r--r--webkit/glue/plugins/fake_plugin_window_tracker_mac.h2
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl.h2
-rw-r--r--webkit/glue/plugins/webplugin_delegate_impl_mac.mm6
-rw-r--r--webkit/glue/webcursor.h5
-rw-r--r--webkit/glue/webcursor_mac.mm66
6 files changed, 84 insertions, 4 deletions
diff --git a/webkit/glue/plugins/fake_plugin_window_tracker_mac.cc b/webkit/glue/plugins/fake_plugin_window_tracker_mac.cc
index 0ca3307..5be919e 100644
--- a/webkit/glue/plugins/fake_plugin_window_tracker_mac.cc
+++ b/webkit/glue/plugins/fake_plugin_window_tracker_mac.cc
@@ -34,10 +34,11 @@ WindowRef FakePluginWindowTracker::GenerateFakeWindowForDelegate(
return new_ref;
}
-const WebPluginDelegateImpl* FakePluginWindowTracker::GetDelegateForFakeWindow(
+WebPluginDelegateImpl* FakePluginWindowTracker::GetDelegateForFakeWindow(
WindowRef window) const {
- return static_cast<const WebPluginDelegateImpl*>(
- CFDictionaryGetValue(window_to_delegate_map_, window));
+ return const_cast<WebPluginDelegateImpl*>(
+ static_cast<const WebPluginDelegateImpl*>(
+ CFDictionaryGetValue(window_to_delegate_map_, window)));
}
void FakePluginWindowTracker::RemoveFakeWindowForDelegate(
diff --git a/webkit/glue/plugins/fake_plugin_window_tracker_mac.h b/webkit/glue/plugins/fake_plugin_window_tracker_mac.h
index 24c1d1f..eeb2c81 100644
--- a/webkit/glue/plugins/fake_plugin_window_tracker_mac.h
+++ b/webkit/glue/plugins/fake_plugin_window_tracker_mac.h
@@ -28,7 +28,7 @@ class __attribute__((visibility("default"))) FakePluginWindowTracker {
WindowRef GenerateFakeWindowForDelegate(WebPluginDelegateImpl* delegate);
// Returns the WebPluginDelegate associated with the given fake window ref.
- const WebPluginDelegateImpl* GetDelegateForFakeWindow(WindowRef window) const;
+ WebPluginDelegateImpl* GetDelegateForFakeWindow(WindowRef window) const;
// Removes the fake window ref entry for |delegate|.
void RemoveFakeWindowForDelegate(WebPluginDelegateImpl* delegate,
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h
index 7cec03d..3e407aa 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl.h
+++ b/webkit/glue/plugins/webplugin_delegate_impl.h
@@ -131,6 +131,8 @@ class WebPluginDelegateImpl : public webkit_glue::WebPluginDelegate {
void SetFocusNotifier(void (*notifier)(WebPluginDelegateImpl*)) {
focus_notifier_ = notifier;
}
+ // Informs the delegate that the plugin set a theme cursor.
+ void SetThemeCursor(ThemeCursor cursor);
#endif
#if !defined(OS_MACOSX)
diff --git a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
index a0cecf5..e7918a9 100644
--- a/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
+++ b/webkit/glue/plugins/webplugin_delegate_impl_mac.mm
@@ -411,6 +411,10 @@ void WebPluginDelegateImpl::SetFocus() {
FocusNotify(this);
}
+void WebPluginDelegateImpl::SetThemeCursor(ThemeCursor cursor) {
+ current_windowless_cursor_.InitFromThemeCursor(cursor);
+}
+
void WebPluginDelegateImpl::UpdatePluginLocation(const WebMouseEvent& event) {
instance()->set_plugin_origin(gfx::Point(event.globalX - event.x,
event.globalY - event.y));
@@ -712,6 +716,8 @@ bool WebPluginDelegateImpl::HandleInputEvent(const WebInputEvent& event,
const WebMouseEvent* mouse_event =
static_cast<const WebMouseEvent*>(&event);
UpdatePluginLocation(*mouse_event);
+
+ current_windowless_cursor_.GetCursorInfo(cursor);
}
#ifndef NP_NO_CARBON
diff --git a/webkit/glue/webcursor.h b/webkit/glue/webcursor.h
index 8697f731..ed59e0b 100644
--- a/webkit/glue/webcursor.h
+++ b/webkit/glue/webcursor.h
@@ -23,6 +23,7 @@ typedef struct _GdkCursor GdkCursor;
#else
class NSCursor;
#endif
+typedef UInt32 ThemeCursor;
#endif
class Pickle;
@@ -85,7 +86,11 @@ class WebCursor {
// returns GDK_CURSOR_IS_PIXMAP.
GdkCursor* GetCustomCursor() const;
#elif defined(OS_MACOSX)
+ // Gets an NSCursor* for this cursor.
NSCursor* GetCursor() const;
+
+ // Initialize this from the given Carbon ThemeCursor.
+ void InitFromThemeCursor(ThemeCursor cursor);
#endif
private:
diff --git a/webkit/glue/webcursor_mac.mm b/webkit/glue/webcursor_mac.mm
index c4ffc39..4a80d32 100644
--- a/webkit/glue/webcursor_mac.mm
+++ b/webkit/glue/webcursor_mac.mm
@@ -5,6 +5,7 @@
#include "webkit/glue/webcursor.h"
#import <AppKit/AppKit.h>
+#include <Carbon/Carbon.h>
#include "base/logging.h"
#include "base/nsimage_cache_mac.h"
@@ -158,6 +159,71 @@ NSCursor* WebCursor::GetCursor() const {
return nil;
}
+void WebCursor::InitFromThemeCursor(ThemeCursor cursor) {
+ WebKit::WebCursorInfo cursor_info;
+
+ switch (cursor) {
+ case kThemeArrowCursor:
+ cursor_info.type = WebCursorInfo::TypePointer;
+ break;
+ case kThemeCopyArrowCursor:
+ cursor_info.type = WebCursorInfo::TypeCopy;
+ break;
+ case kThemeAliasArrowCursor:
+ cursor_info.type = WebCursorInfo::TypeAlias;
+ break;
+ case kThemeContextualMenuArrowCursor:
+ cursor_info.type = WebCursorInfo::TypeContextMenu;
+ break;
+ case kThemeIBeamCursor:
+ cursor_info.type = WebCursorInfo::TypeIBeam;
+ break;
+ case kThemeCrossCursor:
+ case kThemePlusCursor:
+ cursor_info.type = WebCursorInfo::TypeCross;
+ break;
+ case kThemeWatchCursor:
+ case kThemeSpinningCursor:
+ cursor_info.type = WebCursorInfo::TypeWait;
+ break;
+ case kThemeClosedHandCursor:
+ case kThemeOpenHandCursor:
+ case kThemePointingHandCursor:
+ case kThemeCountingUpHandCursor:
+ case kThemeCountingDownHandCursor:
+ case kThemeCountingUpAndDownHandCursor:
+ cursor_info.type = WebCursorInfo::TypeHand;
+ break;
+ case kThemeResizeLeftCursor:
+ cursor_info.type = WebCursorInfo::TypeWestResize;
+ break;
+ case kThemeResizeRightCursor:
+ cursor_info.type = WebCursorInfo::TypeEastResize;
+ break;
+ case kThemeResizeLeftRightCursor:
+ cursor_info.type = WebCursorInfo::TypeEastWestResize;
+ break;
+ case kThemeNotAllowedCursor:
+ cursor_info.type = WebCursorInfo::TypeNotAllowed;
+ break;
+ case kThemeResizeUpCursor:
+ cursor_info.type = WebCursorInfo::TypeNorthResize;
+ break;
+ case kThemeResizeDownCursor:
+ cursor_info.type = WebCursorInfo::TypeSouthResize;
+ break;
+ case kThemeResizeUpDownCursor:
+ cursor_info.type = WebCursorInfo::TypeNorthSouthResize;
+ break;
+ case kThemePoofCursor: // *shrug*
+ default:
+ cursor_info.type = WebCursorInfo::TypePointer;
+ break;
+ }
+
+ InitFromCursorInfo(cursor_info);
+}
+
void WebCursor::SetCustomData(const WebImage& image) {
if (image.isNull())
return;