Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1243)

Unified Diff: content/renderer/pepper_plugin_delegate_impl.h

Issue 7863003: Mouse lock implementation, including the renderer side and the Windows version of the browser side. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove two tab chars. Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..403d26d1d73fcb26d21227c849f282b10a9b5874 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 WebMouseEvent;
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::WebMouseEvent& 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 MouseLockedOrPending() const {
+ 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
brettw 2011/09/14 22:17:58 is not NULL -> being non-NULL
yzshen1 2011/09/19 20:48:41 Done.
+ // 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);
};

Powered by Google App Engine
This is Rietveld 408576698