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

Unified Diff: content/renderer/render_view_impl.h

Issue 8970016: refactoring mouse lock to support pepper and WebKit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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/render_view_impl.h
diff --git a/content/renderer/render_view_impl.h b/content/renderer/render_view_impl.h
index cb8ac8f2d42edca58a9ecd516baf86c5d7c93489..65d43c1c5ed4419082ec2add21673707d9bee8d8 100644
--- a/content/renderer/render_view_impl.h
+++ b/content/renderer/render_view_impl.h
@@ -307,6 +307,9 @@ class RenderViewImpl : public RenderWidget,
virtual void runModal();
virtual bool enterFullScreen();
virtual void exitFullScreen();
+ virtual void lockPointer();
+ virtual void unlockPointer();
+ virtual bool isPointerLocked();
// WebKit::WebViewClient implementation --------------------------------------
@@ -797,9 +800,9 @@ class RenderViewImpl : public RenderWidget,
const std::vector<GURL>& links,
const std::vector<FilePath>& local_paths,
const FilePath& local_directory_name);
- void OnLockMouseACK(bool succeeded);
void OnMediaPlayerActionAt(const gfx::Point& location,
const WebKit::WebMediaPlayerAction& action);
+ void OnLockMouseACK(bool succeeded);
void OnMouseLockLost();
void OnMoveOrResizeStarted();
CONTENT_EXPORT void OnNavigate(const ViewMsg_Navigate_Params& params);
@@ -1232,6 +1235,37 @@ class RenderViewImpl : public RenderWidget,
// notifications.
// ---------------------------------------------------------------------------
+ // TEMP -- REFACTOR TO A DISPATCHER
yzshen1 2012/01/04 00:50:00 We probably cannot check in the code without a nic
+public:
+ bool lockPointer(WebKit::WebWidget* webwidget) { return LockMouseInternal(webwidget, NULL); }
+ bool LockMouse(webkit::ppapi::PluginInstance* pinstance) { return LockMouseInternal(NULL, pinstance); }
+ void unlockPointer(WebKit::WebWidget* webwidget) { UnlockMouseInternal(webwidget, NULL); }
+ void UnlockMouse(webkit::ppapi::PluginInstance* pinstance) { UnlockMouseInternal(NULL, pinstance); }
+private:
+ bool LockMouseInternal(WebKit::WebWidget* webwidget, webkit::ppapi::PluginInstance* pinstance);
+ void UnlockMouseInternal(WebKit::WebWidget* webwidget, webkit::ppapi::PluginInstance* pinstance);
+ bool MouseLockedOrPendingAction() const {
+ return mouse_locked_ || pending_lock_request_ || pending_unlock_request_;
+ }
+
+ 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_;
+
+ // |mouse_lock_owner_| is not owned by this class.
+//???????? need to deal with it being deleted?
yzshen1 2012/01/04 00:50:00 As far as PPAPI is concerned, we will get a notifi
+ // |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::WebWidget* mouse_lock_webwidget_owner_;
+ webkit::ppapi::PluginInstance* mouse_lock_pinstance_owner_;
+ // TEMP -- REFACTOR TO A DISPATCHER
+
DISALLOW_COPY_AND_ASSIGN(RenderViewImpl);
};

Powered by Google App Engine
This is Rietveld 408576698