diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-06 00:36:52 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-06 00:36:52 +0000 |
commit | 4c870b4013b3cf658c40e2c7b98e0a419ae7236f (patch) | |
tree | e701a8ab7b093e04367a0956e7ff94a702806e6c /webkit/glue/plugins | |
parent | 983f7bd3fa88bbdac942dbfaf0269b1684a5c1ee (diff) | |
download | chromium_src-4c870b4013b3cf658c40e2c7b98e0a419ae7236f.zip chromium_src-4c870b4013b3cf658c40e2c7b98e0a419ae7236f.tar.gz chromium_src-4c870b4013b3cf658c40e2c7b98e0a419ae7236f.tar.bz2 |
Eliminate CursorChromium's dependency on webkit/glue.
Also modified WidgetChromium to use ChromiumBridge instead of talking to ChromeClientChromium. I want to eliminate that fake interface in favor of just having our code talk directly to ChromeClientImpl, but that means a dependency on webkit/glue, so I needed to use ChromiumBridge. Long-term, I'd like to propose changes upstream to HostWindow and ChromeClient to avoid this usage of ChromiumBridge.
The most impactful part of this CL is the change to move the enumeration of cursor types from WebCursor to PlatformCursor. This means that WebCursor consumers no longer have access to the type enumeration. I replaced that with helper functions on WebCursor. I think the result not only achieves the goal of breaking CursorChromium's dependency on webkit/glue but is also much cleaner.
R=iyengar,eseidel
Review URL: http://codereview.chromium.org/9072
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4846 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/plugins')
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.cc | 41 | ||||
-rw-r--r-- | webkit/glue/plugins/webplugin_delegate_impl.h | 4 |
2 files changed, 9 insertions, 36 deletions
diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index 38fdde7..fd31ab7 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -973,6 +973,14 @@ bool WebPluginDelegateImpl::HandleEvent(NPEvent* event, bool ret = instance()->NPP_HandleEvent(event) != 0; + // Snag a reference to the current cursor ASAP in case the plugin modified + // it. There is a nasty race condition here with the multiprocess browser + // as someone might be setting the cursor in the main process as well. + HCURSOR last_cursor; + if (WM_MOUSEMOVE == event->event) { + last_cursor = ::GetCursor(); + } + if (pop_user_gesture) { instance()->PopPopupsEnabledState(); } @@ -1000,43 +1008,12 @@ bool WebPluginDelegateImpl::HandleEvent(NPEvent* event, } if (WM_MOUSEMOVE == event->event) { - HCURSOR actual_cursor = ::GetCursor(); - *cursor = GetCursorType(actual_cursor); + cursor->InitFromCursor(last_cursor); } return ret; } -WebCursor::Type WebPluginDelegateImpl::GetCursorType( - HCURSOR cursor) const { - static HCURSOR standard_cursors[] = { - LoadCursor(NULL, IDC_ARROW), - LoadCursor(NULL, IDC_IBEAM), - LoadCursor(NULL, IDC_WAIT), - LoadCursor(NULL, IDC_CROSS), - LoadCursor(NULL, IDC_UPARROW), - LoadCursor(NULL, IDC_SIZE), - LoadCursor(NULL, IDC_ICON), - LoadCursor(NULL, IDC_SIZENWSE), - LoadCursor(NULL, IDC_SIZENESW), - LoadCursor(NULL, IDC_SIZEWE), - LoadCursor(NULL, IDC_SIZENS), - LoadCursor(NULL, IDC_SIZEALL), - LoadCursor(NULL, IDC_NO), - LoadCursor(NULL, IDC_HAND), - LoadCursor(NULL, IDC_APPSTARTING), - LoadCursor(NULL, IDC_HELP), - }; - - for (int cursor_index = 0; cursor_index < arraysize(standard_cursors); - cursor_index++) { - if (cursor == standard_cursors[cursor_index]) - return static_cast<WebCursor::Type>(cursor_index); - } - - return WebCursor::ARROW; -} - WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( int resource_id, const std::string &url, bool notify_needed, void *notify_data, void* existing_stream) { diff --git a/webkit/glue/plugins/webplugin_delegate_impl.h b/webkit/glue/plugins/webplugin_delegate_impl.h index 6d67dc7..57f7273 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.h +++ b/webkit/glue/plugins/webplugin_delegate_impl.h @@ -165,10 +165,6 @@ class WebPluginDelegateImpl : public WebPluginDelegate { // Closes down and destroys our plugin instance. void DestroyInstance(); - // Returns the cursor type. - // TODO(iyengar) Add support for custom cursors. - WebCursor::Type GetCursorType(HCURSOR cursor) const; - // used for windowed plugins HWND windowed_handle_; bool windowed_did_set_window_; |