OLD | NEW |
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/renderer/render_view_mouse_lock_dispatcher.h" | 5 #include "content/renderer/render_view_mouse_lock_dispatcher.h" |
6 | 6 |
7 #include "content/common/view_messages.h" | 7 #include "content/common/view_messages.h" |
8 #include "content/renderer/render_view_impl.h" | 8 #include "content/renderer/render_view_impl.h" |
9 #include "third_party/WebKit/public/web/WebFrame.h" | 9 #include "third_party/WebKit/public/web/WebFrame.h" |
10 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 10 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 IPC_BEGIN_MESSAGE_MAP(RenderViewMouseLockDispatcher, message) | 42 IPC_BEGIN_MESSAGE_MAP(RenderViewMouseLockDispatcher, message) |
43 IPC_MESSAGE_HANDLER(ViewMsg_LockMouse_ACK, OnLockMouseACK) | 43 IPC_MESSAGE_HANDLER(ViewMsg_LockMouse_ACK, OnLockMouseACK) |
44 IPC_MESSAGE_FORWARD(ViewMsg_MouseLockLost, | 44 IPC_MESSAGE_FORWARD(ViewMsg_MouseLockLost, |
45 static_cast<MouseLockDispatcher*>(this), | 45 static_cast<MouseLockDispatcher*>(this), |
46 MouseLockDispatcher::OnMouseLockLost) | 46 MouseLockDispatcher::OnMouseLockLost) |
47 IPC_MESSAGE_UNHANDLED(handled = false) | 47 IPC_MESSAGE_UNHANDLED(handled = false) |
48 IPC_END_MESSAGE_MAP() | 48 IPC_END_MESSAGE_MAP() |
49 return handled; | 49 return handled; |
50 } | 50 } |
51 | 51 |
| 52 void RenderViewMouseLockDispatcher::OnDestruct() { |
| 53 delete this; |
| 54 } |
| 55 |
52 void RenderViewMouseLockDispatcher::OnLockMouseACK(bool succeeded) { | 56 void RenderViewMouseLockDispatcher::OnLockMouseACK(bool succeeded) { |
53 // Notify the base class. | 57 // Notify the base class. |
54 MouseLockDispatcher::OnLockMouseACK(succeeded); | 58 MouseLockDispatcher::OnLockMouseACK(succeeded); |
55 | 59 |
56 // Mouse Lock removes the system cursor and provides all mouse motion as | 60 // Mouse Lock removes the system cursor and provides all mouse motion as |
57 // .movementX/Y values on events all sent to a fixed target. This requires | 61 // .movementX/Y values on events all sent to a fixed target. This requires |
58 // content to specifically request the mode to be entered. | 62 // content to specifically request the mode to be entered. |
59 // Mouse Capture is implicitly given for the duration of a drag event, and | 63 // Mouse Capture is implicitly given for the duration of a drag event, and |
60 // sends all mouse events to the initial target of the drag. | 64 // sends all mouse events to the initial target of the drag. |
61 // If Lock is entered it supercedes any in progress Capture. | 65 // If Lock is entered it supercedes any in progress Capture. |
62 if (succeeded && render_view_impl_->GetWidget()->webwidget()) | 66 if (succeeded && render_view_impl_->GetWidget()->webwidget()) |
63 render_view_impl_->GetWidget()->webwidget()->mouseCaptureLost(); | 67 render_view_impl_->GetWidget()->webwidget()->mouseCaptureLost(); |
64 } | 68 } |
65 | 69 |
66 } // namespace content | 70 } // namespace content |
OLD | NEW |