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

Unified Diff: content/browser/renderer_host/render_widget_host_view.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
Index: content/browser/renderer_host/render_widget_host_view.h
diff --git a/content/browser/renderer_host/render_widget_host_view.h b/content/browser/renderer_host/render_widget_host_view.h
index 3456a67708a87c4a1fe463dcb44f2d8b2fff4047..8859d2a0ec36457a67dd86f3a48525173165873a 100644
--- a/content/browser/renderer_host/render_widget_host_view.h
+++ b/content/browser/renderer_host/render_widget_host_view.h
@@ -313,6 +313,10 @@ class RenderWidgetHostView {
virtual void SetScrollOffsetPinning(
bool is_pinned_to_left, bool is_pinned_to_right) = 0;
+ // Return value indicates whether the mouse is locked successfully or not.
+ virtual bool LockMouse() = 0;
+ virtual void UnlockMouse() = 0;
+
void set_popup_type(WebKit::WebPopupType popup_type) {
popup_type_ = popup_type;
}
@@ -334,9 +338,11 @@ class RenderWidgetHostView {
reserved_rect_ = reserved_rect;
}
+ bool mouse_locked() const { return mouse_locked_; }
+
protected:
// Interface class only, do not construct.
- RenderWidgetHostView() : popup_type_(WebKit::WebPopupTypeNone) {}
+ RenderWidgetHostView();
// Whether this view is a popup and what kind of popup it is (select,
// autofill...).
@@ -350,6 +356,13 @@ class RenderWidgetHostView {
// rendered to draw the resize corner, sidebar mini tabs etc.
gfx::Rect reserved_rect_;
+ // While the mouse is locked, the cursor is hidden from the user. Mouse events
+ // are still generated. However, the position they report is the last known
+ // mouse position just as mouse lock was entered; the movement they report
+ // indicates what the change in position of the mouse would be had it not been
+ // locked.
+ bool mouse_locked_;
+
private:
DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostView);
};
« no previous file with comments | « content/browser/renderer_host/render_widget_host.cc ('k') | content/browser/renderer_host/render_widget_host_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698