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

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: . 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
« no previous file with comments | « content/common/view_messages.h ('k') | content/renderer/pepper_plugin_delegate_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 cf8d2c371bfe3d9004a7a9837eef96275cf73fb5..f8dcd56ff23bf2a973f993c1f31bb5b1a17cfbba 100644
--- a/content/renderer/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper_plugin_delegate_impl.h
@@ -45,6 +45,7 @@ class PluginModule;
namespace WebKit {
class WebFileChooserCompletion;
+class WebMouseEvent;
struct WebFileChooserParams;
}
@@ -168,6 +169,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);
@@ -305,6 +315,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;
CONTENT_EXPORT int GetRoutingId() const;
@@ -317,6 +329,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_;
@@ -347,6 +363,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_| being non-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);
};
« no previous file with comments | « content/common/view_messages.h ('k') | content/renderer/pepper_plugin_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698