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 b3782d3b7422545337ceaf49ddf90f6d97839153..9fdd21ba6e5ff1aa5ac3632777c82e931f901fdb 100644 |
| --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc |
| +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc |
| @@ -1663,13 +1663,13 @@ bool PluginInstance::IsFullPagePlugin() const { |
| return frame->view()->mainFrame()->document().isPluginDocument(); |
| } |
| -void PluginInstance::OnLockMouseACK(int32_t result) { |
| +void PluginInstance::OnLockMouseACK(bool succeeded) { |
|
yzshen1
2012/01/16 07:50:35
Please use the same parameter name as in the .h fi
scheib
2012/01/17 22:05:36
Done.
|
| 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() { |
| @@ -1677,6 +1677,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) { |
| @@ -1962,16 +1969,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 |
|
yzshen1
2012/01/16 07:50:35
- Please use a complete sentence. (With capital le
scheib
2012/01/17 22:05:36
Done.
|
| 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; |
| + } |
| } |
| void PluginInstance::UnlockMouse(PP_Instance instance) { |