diff options
author | tzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 07:35:15 +0000 |
---|---|---|
committer | tzik@chromium.org <tzik@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 07:35:15 +0000 |
commit | 9f064462db5b4a434d5897d524640797c55fb1b1 (patch) | |
tree | 3d3901cc25f2b1b73a5b018079a96e9113fda5ab /webkit | |
parent | a596e11f92a756e946ee1c4c64e9d9c083d13a2a (diff) | |
download | chromium_src-9f064462db5b4a434d5897d524640797c55fb1b1.zip chromium_src-9f064462db5b4a434d5897d524640797c55fb1b1.tar.gz chromium_src-9f064462db5b4a434d5897d524640797c55fb1b1.tar.bz2 |
Revert 119206 - Mouse Lock is currently supported in Pepper, but not yet supported from WebKit.
Move the render thread logic for managing the mouse lock state out of the pepper_plugin_delegate_impl, and into a higher level dispatcher for render_view_impl.
Handle mouse lock / pointer lock requests from both pepper and webkit (WebKit API not yet landed, small TODOs left in this code to enable once that lands).
BUG=109957
TEST=Pepper examples/mouse_lock and NaCl mouse lock examples still work.
Review URL: http://codereview.chromium.org/8970016
TBR=scheib@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9293001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.cc | 8 | ||||
-rw-r--r-- | webkit/plugins/ppapi/mock_plugin_delegate.h | 3 | ||||
-rw-r--r-- | webkit/plugins/ppapi/plugin_delegate.h | 13 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.cc | 30 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.h | 7 |
5 files changed, 18 insertions, 43 deletions
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc index 780bf4c..da371c54 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.cc +++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc @@ -348,17 +348,13 @@ base::SharedMemory* MockPluginDelegate::CreateAnonymousSharedMemory( return ::ppapi::Preferences(); } -bool MockPluginDelegate::LockMouse(PluginInstance* instance) { - return false; +void MockPluginDelegate::LockMouse(PluginInstance* instance) { + instance->OnLockMouseACK(PP_ERROR_FAILED); } void MockPluginDelegate::UnlockMouse(PluginInstance* instance) { } -bool MockPluginDelegate::IsMouseLocked(PluginInstance* instance) { - return false; -} - void MockPluginDelegate::DidChangeCursor(PluginInstance* instance, const WebKit::WebCursorInfo& cursor) { } diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h index 4768080..fbd961a 100644 --- a/webkit/plugins/ppapi/mock_plugin_delegate.h +++ b/webkit/plugins/ppapi/mock_plugin_delegate.h @@ -148,9 +148,8 @@ class MockPluginDelegate : public PluginDelegate { virtual std::string GetFlashCommandLineArgs(); virtual base::SharedMemory* CreateAnonymousSharedMemory(uint32_t size); virtual ::ppapi::Preferences GetPreferences(); - virtual bool LockMouse(PluginInstance* instance); + virtual void LockMouse(PluginInstance* instance); virtual void UnlockMouse(PluginInstance* instance); - virtual bool IsMouseLocked(PluginInstance* instance); virtual void DidChangeCursor(PluginInstance* instance, const WebKit::WebCursorInfo& cursor); virtual void DidReceiveMouseEvent(PluginInstance* instance); diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h index d91621c..6f9a17e 100644 --- a/webkit/plugins/ppapi/plugin_delegate.h +++ b/webkit/plugins/ppapi/plugin_delegate.h @@ -490,11 +490,11 @@ class PluginDelegate { // Returns the current preferences. virtual ::ppapi::Preferences GetPreferences() = 0; - // Locks the mouse for |instance|. If false is returned, the lock is not - // possible. If true is returned then the lock is pending. Success or - // failure will be delivered asynchronously via - // PluginInstance::OnLockMouseACK(). - virtual bool LockMouse(PluginInstance* instance) = 0; + // Locks the mouse for |instance|. It will call + // PluginInstance::OnLockMouseACK() to notify the instance when the operation + // is completed. The call to OnLockMouseACK() may be synchronous (i.e., it may + // be called when LockMouse() is still on the stack). + virtual void LockMouse(PluginInstance* instance) = 0; // Unlocks the mouse if |instance| currently owns the mouse lock. Whenever an // plugin instance has lost the mouse lock, it will be notified by @@ -504,9 +504,6 @@ class PluginDelegate { // call to the current mouse lock owner. virtual void UnlockMouse(PluginInstance* instance) = 0; - // Returns true iff |instance| currently owns the mouse lock. - virtual bool IsMouseLocked(PluginInstance* instance) = 0; - // Notifies that |instance| has changed the cursor. // This will update the cursor appearance if it is currently over the plugin // instance. diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index 23a1862..7f849f6 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -1675,13 +1675,13 @@ bool PluginInstance::IsFullPagePlugin() const { return frame->view()->mainFrame()->document().isPluginDocument(); } -void PluginInstance::OnLockMouseACK(bool succeeded) { +void PluginInstance::OnLockMouseACK(int32_t result) { if (!lock_mouse_callback_.func) { NOTREACHED(); return; } - PP_RunAndClearCompletionCallback(&lock_mouse_callback_, - succeeded ? PP_OK : PP_ERROR_FAILED); + + PP_RunAndClearCompletionCallback(&lock_mouse_callback_, result); } void PluginInstance::OnMouseLockLost() { @@ -1689,13 +1689,6 @@ void PluginInstance::OnMouseLockLost() { plugin_mouse_lock_interface_->MouseLockLost(pp_instance()); } -void PluginInstance::HandleMouseLockedInputEvent( - const WebKit::WebMouseEvent& event) { - // |cursor_info| is ignored since it is hidden when the mouse is locked. - WebKit::WebCursorInfo cursor_info; - HandleInputEvent(event, &cursor_info); -} - void PluginInstance::SimulateInputEvent(const InputEventData& input_event) { WebView* web_view = container()->element().document().frame()->view(); if (!web_view) { @@ -1981,21 +1974,16 @@ int32_t PluginInstance::LockMouse(PP_Instance instance, // Don't support synchronous call. return PP_ERROR_BLOCKS_MAIN_THREAD; } - if (lock_mouse_callback_.func) // A lock is pending. + if (lock_mouse_callback_.func) return PP_ERROR_INPROGRESS; - - if (delegate()->IsMouseLocked(this)) - return PP_OK; - if (!CanAccessMainFrame()) return PP_ERROR_NOACCESS; - if (delegate()->LockMouse(this)) { - lock_mouse_callback_ = callback; - return PP_OK_COMPLETIONPENDING; - } else { - return PP_ERROR_FAILED; - } + lock_mouse_callback_ = callback; + // We will be notified on completion via OnLockMouseACK(), either + // synchronously or asynchronously. + delegate()->LockMouse(this); + return PP_OK_COMPLETIONPENDING; } void PluginInstance::UnlockMouse(PP_Instance instance) { diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index c8a6332..086125f 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -52,7 +52,6 @@ class TransportDIB; namespace WebKit { class WebInputEvent; -class WebMouseEvent; class WebPluginContainer; struct WebCompositionUnderline; struct WebCursorInfo; @@ -306,12 +305,8 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance : // or embedded in a page). bool IsFullPagePlugin() const; - // A mouse lock request was pending and this reports success or failure. - void OnLockMouseACK(bool succeeded); - // A mouse lock was in place, but has been lost. + void OnLockMouseACK(int32_t result); void OnMouseLockLost(); - // A mouse lock is enabled and mouse events are being delievered. - void HandleMouseLockedInputEvent(const WebKit::WebMouseEvent& event); // Simulates an input event to the plugin by passing it down to WebKit, // which sends it back up to the plugin as if it came from the user. |