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

Side by Side Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 10443045: Silent mouse lock after unlock by target (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Update for silent mouse relock Created 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/render_widget_host_impl.h" 5 #include "content/browser/renderer_host/render_widget_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 1033
1034 void RenderWidgetHostImpl::ImeCancelComposition() { 1034 void RenderWidgetHostImpl::ImeCancelComposition() {
1035 Send(new ViewMsg_ImeSetComposition(GetRoutingID(), string16(), 1035 Send(new ViewMsg_ImeSetComposition(GetRoutingID(), string16(),
1036 std::vector<WebKit::WebCompositionUnderline>(), 0, 0)); 1036 std::vector<WebKit::WebCompositionUnderline>(), 0, 0));
1037 } 1037 }
1038 1038
1039 gfx::Rect RenderWidgetHostImpl::GetRootWindowResizerRect() const { 1039 gfx::Rect RenderWidgetHostImpl::GetRootWindowResizerRect() const {
1040 return gfx::Rect(); 1040 return gfx::Rect();
1041 } 1041 }
1042 1042
1043 void RenderWidgetHostImpl::RequestToLockMouse(bool /* user_gesture */) { 1043 void RenderWidgetHostImpl::RequestToLockMouse(
1044 MouseLockSource /* lock_source */,
1045 MouseUnlockSource /* previous_unlock_source */) {
1044 // Directly reject to lock the mouse. Subclass can override this method to 1046 // Directly reject to lock the mouse. Subclass can override this method to
1045 // decide whether to allow mouse lock or not. 1047 // decide whether to allow mouse lock or not.
1046 GotResponseToLockMouseRequest(false); 1048 GotResponseToLockMouseRequest(false);
1047 } 1049 }
1048 1050
1049 void RenderWidgetHostImpl::RejectMouseLockOrUnlockIfNecessary() { 1051 void RenderWidgetHostImpl::RejectMouseLockOrUnlockIfNecessary() {
1050 DCHECK(!pending_mouse_lock_request_ || !IsMouseLocked()); 1052 DCHECK(!pending_mouse_lock_request_ || !IsMouseLocked());
1051 if (pending_mouse_lock_request_) { 1053 if (pending_mouse_lock_request_) {
1052 pending_mouse_lock_request_ = false; 1054 pending_mouse_lock_request_ = false;
1053 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); 1055 Send(new ViewMsg_LockMouse_ACK(routing_id_, false));
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1478 void RenderWidgetHostImpl::OnMsgDidActivateAcceleratedCompositing( 1480 void RenderWidgetHostImpl::OnMsgDidActivateAcceleratedCompositing(
1479 bool activated) { 1481 bool activated) {
1480 TRACE_EVENT1("renderer_host", 1482 TRACE_EVENT1("renderer_host",
1481 "RenderWidgetHostImpl::OnMsgDidActivateAcceleratedCompositing", 1483 "RenderWidgetHostImpl::OnMsgDidActivateAcceleratedCompositing",
1482 "activated", activated); 1484 "activated", activated);
1483 is_accelerated_compositing_active_ = activated; 1485 is_accelerated_compositing_active_ = activated;
1484 if (view_) 1486 if (view_)
1485 view_->OnAcceleratedCompositingStateChange(); 1487 view_->OnAcceleratedCompositingStateChange();
1486 } 1488 }
1487 1489
1488 void RenderWidgetHostImpl::OnMsgLockMouse(bool user_gesture) { 1490 void RenderWidgetHostImpl::OnMsgLockMouse(
1491 MouseLockSource lock_source,
1492 MouseUnlockSource previous_unlock_source) {
1493
1489 if (pending_mouse_lock_request_) { 1494 if (pending_mouse_lock_request_) {
1490 Send(new ViewMsg_LockMouse_ACK(routing_id_, false)); 1495 Send(new ViewMsg_LockMouse_ACK(routing_id_, false));
1491 return; 1496 return;
1492 } else if (IsMouseLocked()) { 1497 } else if (IsMouseLocked()) {
1493 Send(new ViewMsg_LockMouse_ACK(routing_id_, true)); 1498 Send(new ViewMsg_LockMouse_ACK(routing_id_, true));
1494 return; 1499 return;
1495 } 1500 }
1496 1501
1497 pending_mouse_lock_request_ = true; 1502 pending_mouse_lock_request_ = true;
1498 RequestToLockMouse(user_gesture); 1503 RequestToLockMouse(lock_source, previous_unlock_source);
1499 } 1504 }
1500 1505
1501 void RenderWidgetHostImpl::OnMsgUnlockMouse() { 1506 void RenderWidgetHostImpl::OnMsgUnlockMouse() {
1502 RejectMouseLockOrUnlockIfNecessary(); 1507 RejectMouseLockOrUnlockIfNecessary();
1503 } 1508 }
1504 1509
1505 #if defined(OS_POSIX) || defined(USE_AURA) 1510 #if defined(OS_POSIX) || defined(USE_AURA)
1506 void RenderWidgetHostImpl::OnMsgGetWindowRect(gfx::NativeViewId window_id, 1511 void RenderWidgetHostImpl::OnMsgGetWindowRect(gfx::NativeViewId window_id,
1507 gfx::Rect* results) { 1512 gfx::Rect* results) {
1508 if (view_) 1513 if (view_)
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 // indicate that no callback is in progress (i.e. without this line 1789 // indicate that no callback is in progress (i.e. without this line
1785 // DelayedAutoResized will not get called again). 1790 // DelayedAutoResized will not get called again).
1786 new_auto_size_.SetSize(0, 0); 1791 new_auto_size_.SetSize(0, 0);
1787 if (!should_auto_resize_) 1792 if (!should_auto_resize_)
1788 return; 1793 return;
1789 1794
1790 OnRenderAutoResized(new_size); 1795 OnRenderAutoResized(new_size);
1791 } 1796 }
1792 1797
1793 } // namespace content 1798 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698