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

Side by Side Diff: content/renderer/render_view_mouse_lock_dispatcher.cc

Issue 12570005: Update user gesture related code to the new WebKit API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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/Source/WebKit/chromium/public/WebFrame.h" 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebUserGestureIndicat or.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h"
12 13
14 using WebKit::WebUserGestureIndicator;
15
13 namespace content { 16 namespace content {
14 17
15 RenderViewMouseLockDispatcher::RenderViewMouseLockDispatcher( 18 RenderViewMouseLockDispatcher::RenderViewMouseLockDispatcher(
16 RenderViewImpl* render_view_impl) 19 RenderViewImpl* render_view_impl)
17 : RenderViewObserver(render_view_impl), 20 : RenderViewObserver(render_view_impl),
18 render_view_impl_(render_view_impl) { 21 render_view_impl_(render_view_impl) {
19 } 22 }
20 23
21 RenderViewMouseLockDispatcher::~RenderViewMouseLockDispatcher() { 24 RenderViewMouseLockDispatcher::~RenderViewMouseLockDispatcher() {
22 } 25 }
23 26
24 void RenderViewMouseLockDispatcher::SendLockMouseRequest( 27 void RenderViewMouseLockDispatcher::SendLockMouseRequest(
25 bool unlocked_by_target) { 28 bool unlocked_by_target) {
26 bool user_gesture = 29 bool user_gesture = WebUserGestureIndicator::isProcessingUserGesture();
27 render_view_impl_->webview() &&
28 render_view_impl_->webview()->mainFrame() &&
29 render_view_impl_->webview()->mainFrame()->isProcessingUserGesture();
30 30
31 Send(new ViewHostMsg_LockMouse(routing_id(), user_gesture, unlocked_by_target, 31 Send(new ViewHostMsg_LockMouse(routing_id(), user_gesture, unlocked_by_target,
32 false)); 32 false));
33 } 33 }
34 34
35 void RenderViewMouseLockDispatcher::SendUnlockMouseRequest() { 35 void RenderViewMouseLockDispatcher::SendUnlockMouseRequest() {
36 Send(new ViewHostMsg_UnlockMouse(routing_id())); 36 Send(new ViewHostMsg_UnlockMouse(routing_id()));
37 } 37 }
38 38
39 bool RenderViewMouseLockDispatcher::OnMessageReceived( 39 bool RenderViewMouseLockDispatcher::OnMessageReceived(
(...skipping 17 matching lines...) Expand all
57 // .movementX/Y values on events all sent to a fixed target. This requires 57 // .movementX/Y values on events all sent to a fixed target. This requires
58 // content to specifically request the mode to be entered. 58 // content to specifically request the mode to be entered.
59 // Mouse Capture is implicitly given for the duration of a drag event, and 59 // 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. 60 // sends all mouse events to the initial target of the drag.
61 // If Lock is entered it supercedes any in progress Capture. 61 // If Lock is entered it supercedes any in progress Capture.
62 if (succeeded && render_view_impl_->webwidget()) 62 if (succeeded && render_view_impl_->webwidget())
63 render_view_impl_->webwidget()->mouseCaptureLost(); 63 render_view_impl_->webwidget()->mouseCaptureLost();
64 } 64 }
65 65
66 } // namespace content 66 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_view_impl.cc ('k') | webkit/plugins/ppapi/ppapi_plugin_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698