| 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_widget_mouse_lock_dispatcher.h" | 5 #include "content/renderer/render_widget_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 "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
| 10 #include "third_party/WebKit/public/web/WebFrame.h" | 10 #include "third_party/WebKit/public/web/WebFrame.h" |
| 11 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 11 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
| 12 #include "third_party/WebKit/public/web/WebView.h" | 12 #include "third_party/WebKit/public/web/WebView.h" |
| 13 #include "third_party/WebKit/public/web/WebWidget.h" | 13 #include "third_party/WebKit/public/web/WebWidget.h" |
| 14 | 14 |
| 15 using blink::WebUserGestureIndicator; | 15 using blink::WebUserGestureIndicator; |
| 16 | 16 |
| 17 namespace content { | 17 namespace content { |
| 18 | 18 |
| 19 RenderWidgetMouseLockDispatcher::RenderWidgetMouseLockDispatcher( | 19 RenderWidgetMouseLockDispatcher::RenderWidgetMouseLockDispatcher( |
| 20 RenderWidget* render_widget) | 20 RenderWidget* render_widget) |
| 21 : render_widget_(render_widget) {} | 21 : render_widget_(render_widget) {} |
| 22 | 22 |
| 23 RenderWidgetMouseLockDispatcher::~RenderWidgetMouseLockDispatcher() {} | 23 RenderWidgetMouseLockDispatcher::~RenderWidgetMouseLockDispatcher() {} |
| 24 | 24 |
| 25 void RenderWidgetMouseLockDispatcher::SendLockMouseRequest( | 25 void RenderWidgetMouseLockDispatcher::SendLockMouseRequest() { |
| 26 bool unlocked_by_target) { | |
| 27 bool user_gesture = WebUserGestureIndicator::IsProcessingUserGesture(); | 26 bool user_gesture = WebUserGestureIndicator::IsProcessingUserGesture(); |
| 28 | 27 |
| 29 render_widget_->Send(new ViewHostMsg_LockMouse( | 28 render_widget_->Send(new ViewHostMsg_LockMouse(render_widget_->routing_id(), |
| 30 render_widget_->routing_id(), user_gesture, unlocked_by_target, false)); | 29 user_gesture, false)); |
| 31 } | 30 } |
| 32 | 31 |
| 33 void RenderWidgetMouseLockDispatcher::SendUnlockMouseRequest() { | 32 void RenderWidgetMouseLockDispatcher::SendUnlockMouseRequest() { |
| 34 render_widget_->Send( | 33 render_widget_->Send( |
| 35 new ViewHostMsg_UnlockMouse(render_widget_->routing_id())); | 34 new ViewHostMsg_UnlockMouse(render_widget_->routing_id())); |
| 36 } | 35 } |
| 37 | 36 |
| 38 bool RenderWidgetMouseLockDispatcher::OnMessageReceived( | 37 bool RenderWidgetMouseLockDispatcher::OnMessageReceived( |
| 39 const IPC::Message& message) { | 38 const IPC::Message& message) { |
| 40 bool handled = true; | 39 bool handled = true; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 56 // .movementX/Y values on events all sent to a fixed target. This requires | 55 // .movementX/Y values on events all sent to a fixed target. This requires |
| 57 // content to specifically request the mode to be entered. | 56 // content to specifically request the mode to be entered. |
| 58 // Mouse Capture is implicitly given for the duration of a drag event, and | 57 // Mouse Capture is implicitly given for the duration of a drag event, and |
| 59 // sends all mouse events to the initial target of the drag. | 58 // sends all mouse events to the initial target of the drag. |
| 60 // If Lock is entered it supercedes any in progress Capture. | 59 // If Lock is entered it supercedes any in progress Capture. |
| 61 if (succeeded && render_widget_->GetWebWidget()) | 60 if (succeeded && render_widget_->GetWebWidget()) |
| 62 render_widget_->GetWebWidget()->MouseCaptureLost(); | 61 render_widget_->GetWebWidget()->MouseCaptureLost(); |
| 63 } | 62 } |
| 64 | 63 |
| 65 } // namespace content | 64 } // namespace content |
| OLD | NEW |