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

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: Don't pass bool to RejectMouseLockOrUnlockIfNecessary Created 3 years, 7 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 610567e43a9f72e1ced93032dc903e0581b9a79c..12eaaf87d3feabad565849d2def274b44419d49a 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_(),
@@ -2068,7 +2069,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));
@@ -2077,8 +2077,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;
}
@@ -2092,7 +2096,12 @@ void RenderWidgetHostImpl::OnLockMouse(bool user_gesture,
}
void RenderWidgetHostImpl::OnUnlockMouse() {
- RejectMouseLockOrUnlockIfNecessary();
+ if (!pending_mouse_lock_request_ && IsMouseLocked()) {
+ // Got unlock request from renderer. Otherwise we only got |LostMouseLock()|
+ // if user unlocked mouse by pressing ESC.
+ is_last_unlocked_by_target_ = true;
+ view_->UnlockMouse();
+ }
chongz 2017/06/01 14:58:20 Actually I don't think we should use |RejectMouseL
dtapuska 2017/06/05 14:49:49 This pending_mouse_lock_request boolean is a littl
chongz 2017/06/05 15:33:57 Added back |RejectMouseLockOrUnlockIfNecessary()|
}
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