Index: content/renderer/pepper_plugin_delegate_impl.h |
diff --git a/content/renderer/pepper_plugin_delegate_impl.h b/content/renderer/pepper_plugin_delegate_impl.h |
index b254488cf45a68a221affe3bdd8c439c4e99ac5f..ede76c49e46ba07048dbcd16f72ed657cf62ca68 100644 |
--- a/content/renderer/pepper_plugin_delegate_impl.h |
+++ b/content/renderer/pepper_plugin_delegate_impl.h |
@@ -44,6 +44,7 @@ class PluginModule; |
namespace WebKit { |
class WebFileChooserCompletion; |
+class WebInputEvent; |
struct WebFileChooserParams; |
} |
@@ -165,6 +166,15 @@ class PepperPluginDelegateImpl |
// Returns whether or not a Pepper plugin is focused. |
bool IsPluginFocused() const; |
+ // Notification that the request to lock the mouse has completed. |
+ void OnLockMouseACK(bool succeeded); |
+ // Notification that the plugin instance has lost the mouse lock. |
+ void OnMouseLockLost(); |
+ // Dispatches mouse events directly to the owner of the mouse lock. |
+ // True indicates currently the mouse is locked and the event has been |
+ // dispatched to the owner. |
+ bool DispatchLockedMouseEvent(const WebKit::WebInputEvent& event); |
+ |
// PluginDelegate implementation. |
virtual void PluginFocusChanged(bool focused) OVERRIDE; |
virtual void PluginCrashed(webkit::ppapi::PluginInstance* instance); |
@@ -302,6 +312,8 @@ class PepperPluginDelegateImpl |
virtual base::SharedMemory* CreateAnonymousSharedMemory(uint32_t size) |
OVERRIDE; |
virtual ::ppapi::Preferences GetPreferences() OVERRIDE; |
+ virtual void LockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; |
+ virtual void UnlockMouse(webkit::ppapi::PluginInstance* instance) OVERRIDE; |
int GetRoutingId() const; |
@@ -314,6 +326,10 @@ class PepperPluginDelegateImpl |
scoped_refptr<PpapiBrokerImpl> CreatePpapiBroker( |
webkit::ppapi::PluginModule* plugin_module); |
+ bool UsingMouseLock() const { |
scheib
2011/09/09 22:00:06
nit: Consider name, "MouseLockedOrPending"?
yzshen1
2011/09/09 23:16:04
Done.
|
+ return mouse_locked_ || pending_lock_request_ || pending_unlock_request_; |
+ } |
+ |
// Pointer to the RenderView that owns us. |
RenderView* render_view_; |
@@ -344,6 +360,21 @@ class PepperPluginDelegateImpl |
// been updated. |
std::set<webkit::ppapi::PluginInstance*> subscribed_to_policy_updates_; |
+ // |mouse_lock_owner_| is not owned by this class. We can know about when it |
+ // is destroyed via InstanceDeleted(). |
+ // |mouse_lock_owner_| is not NULL doesn't indicate that currently the mouse |
+ // has been locked. It is possible that a request to lock the mouse has been |
+ // sent, but the response hasn't arrived yet. |
+ webkit::ppapi::PluginInstance* mouse_lock_owner_; |
+ bool mouse_locked_; |
+ // If both |pending_lock_request_| and |pending_unlock_request_| are true, |
+ // it means a lock request was sent before an unlock request and we haven't |
+ // received responses for them. |
+ // The logic in LockMouse() makes sure that a lock request won't be sent when |
+ // there is a pending unlock request. |
+ bool pending_lock_request_; |
+ bool pending_unlock_request_; |
+ |
DISALLOW_COPY_AND_ASSIGN(PepperPluginDelegateImpl); |
}; |