Chromium Code Reviews| Index: content/browser/web_contents/web_contents_impl.cc |
| diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
| index 2978fb9e1c1e386f7eec5be92e6fee02b2192435..aebfc621b04a5717759089417a4d33e4f38161fa 100644 |
| --- a/content/browser/web_contents/web_contents_impl.cc |
| +++ b/content/browser/web_contents/web_contents_impl.cc |
| @@ -1683,8 +1683,7 @@ void WebContentsImpl::RenderWidgetDeleted( |
| view_->RestoreFocus(); |
| } |
| - if (mouse_lock_widget_ == render_widget_host) |
| - mouse_lock_widget_ = nullptr; |
| + DCHECK(mouse_lock_widget_ != render_widget_host); |
|
Charlie Reis
2016/07/06 17:41:47
DCHECKs aren't compiled into release builds, so th
lfg
2016/07/07 20:17:35
Let's change it to a CHECK then, so we can force a
Charlie Reis
2016/07/07 21:47:12
Acknowledged.
|
| } |
| void WebContentsImpl::RenderWidgetGotFocus( |
| @@ -1905,6 +1904,11 @@ void WebContentsImpl::LostMouseLock(RenderWidgetHostImpl* render_widget_host) { |
| delegate_->LostMouseLock(); |
| } |
| +bool WebContentsImpl::HasMouseLock(RenderWidgetHostImpl* render_widget_host) { |
| + return mouse_lock_widget_ == render_widget_host && |
| + GetTopLevelRenderWidgetHostView()->IsMouseLocked(); |
|
Charlie Reis
2016/07/06 17:41:47
This is confusing to me at first glance. Why is i
lfg
2016/07/07 20:17:35
There's two parts to this. First the mouse_lock_wi
Charlie Reis
2016/07/07 21:47:12
Acknowledged.
|
| +} |
| + |
| void WebContentsImpl::ForwardCompositorProto( |
| RenderWidgetHostImpl* render_widget_host, |
| const std::vector<uint8_t>& proto) { |
| @@ -2962,8 +2966,11 @@ bool WebContentsImpl::GotResponseToLockMouseRequest(bool allowed) { |
| if (GetBrowserPluginGuest()) |
| return GetBrowserPluginGuest()->LockMouse(allowed); |
| - if (mouse_lock_widget_) |
| - return mouse_lock_widget_->GotResponseToLockMouseRequest(allowed); |
| + if (mouse_lock_widget_ && |
| + mouse_lock_widget_->GotResponseToLockMouseRequest(allowed)) |
| + return true; |
| + |
| + mouse_lock_widget_ = nullptr; |
| return false; |
| } |