Chromium Code Reviews| Index: webkit/plugins/ppapi/ppapi_plugin_instance.cc |
| diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc |
| index 7f849f6537805b61a80ffa96b34dfa7b954e7349..23a18628c751af1bf7de23bbc9dab285debc67c7 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(int32_t result) { |
| +void PluginInstance::OnLockMouseACK(bool succeeded) { |
| if (!lock_mouse_callback_.func) { |
| NOTREACHED(); |
| return; |
| } |
| - |
| - PP_RunAndClearCompletionCallback(&lock_mouse_callback_, result); |
| + PP_RunAndClearCompletionCallback(&lock_mouse_callback_, |
| + succeeded ? PP_OK : PP_ERROR_FAILED); |
| } |
| void PluginInstance::OnMouseLockLost() { |
| @@ -1689,6 +1689,13 @@ 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) { |
| @@ -1974,16 +1981,21 @@ int32_t PluginInstance::LockMouse(PP_Instance instance, |
| // Don't support synchronous call. |
| return PP_ERROR_BLOCKS_MAIN_THREAD; |
| } |
| - if (lock_mouse_callback_.func) |
| + if (lock_mouse_callback_.func) // A lock is pending. |
| return PP_ERROR_INPROGRESS; |
| + |
| + if (delegate()->IsMouseLocked(this)) |
| + return PP_OK; |
| + |
| if (!CanAccessMainFrame()) |
| return PP_ERROR_NOACCESS; |
| - lock_mouse_callback_ = callback; |
| - // We will be notified on completion via OnLockMouseACK(), either |
| - // synchronously or asynchronously. |
| - delegate()->LockMouse(this); |
| - return PP_OK_COMPLETIONPENDING; |
| + if (delegate()->LockMouse(this)) { |
| + lock_mouse_callback_ = callback; |
| + return PP_OK_COMPLETIONPENDING; |
| + } else { |
| + return PP_ERROR_FAILED; |
|
piman
2012/01/18 19:00:59
This function doesn't respect the "always asynchro
yzshen1
2012/01/18 19:21:42
I think that semantics is guaranteed by the thunk
piman
2012/01/18 19:26:00
Ah, ok, that works too. Thanks!
|
| + } |
| } |
| void PluginInstance::UnlockMouse(PP_Instance instance) { |