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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 2915613004: [PointerLock] Move "silent mouse lock" logic from renderer to RWHI (Closed)
Patch Set: jochen's comment: Remove 'const' before local bool Created 3 years, 6 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/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 0b6626467de11a4ed277e12bebe9b56f30714ab8..6f4ddc15c1dcafd945f017a96046a110affd900c 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -286,6 +286,7 @@ RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate,
suppress_events_until_keydown_(false),
pending_mouse_lock_request_(false),
allow_privileged_mouse_lock_(false),
+ is_last_unlocked_by_target_(false),
has_touch_handler_(false),
is_in_touchpad_gesture_fling_(false),
latency_tracker_(),
@@ -2069,7 +2070,6 @@ void RenderWidgetHostImpl::OnImeCancelComposition() {
}
void RenderWidgetHostImpl::OnLockMouse(bool user_gesture,
- bool last_unlocked_by_target,
bool privileged) {
if (pending_mouse_lock_request_) {
Send(new ViewMsg_LockMouse_ACK(routing_id_, false));
@@ -2078,8 +2078,12 @@ void RenderWidgetHostImpl::OnLockMouse(bool user_gesture,
pending_mouse_lock_request_ = true;
if (delegate_) {
- delegate_->RequestToLockMouse(this, user_gesture, last_unlocked_by_target,
+ delegate_->RequestToLockMouse(this, user_gesture,
+ is_last_unlocked_by_target_,
privileged && allow_privileged_mouse_lock_);
+ // We need to reset |is_last_unlocked_by_target_| here as we don't know
+ // request source in |LostMouseLock()|.
+ is_last_unlocked_by_target_ = false;
return;
}
@@ -2093,7 +2097,12 @@ void RenderWidgetHostImpl::OnLockMouse(bool user_gesture,
}
void RenderWidgetHostImpl::OnUnlockMouse() {
+ // Got unlock request from renderer. Will update |is_last_unlocked_by_target_|
+ // for silent re-lock.
+ const bool was_mouse_locked = !pending_mouse_lock_request_ && IsMouseLocked();
RejectMouseLockOrUnlockIfNecessary();
+ if (was_mouse_locked)
+ is_last_unlocked_by_target_ = true;
}
void RenderWidgetHostImpl::OnShowDisambiguationPopup(
« no previous file with comments | « content/browser/renderer_host/render_widget_host_impl.h ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698