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

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

Issue 10458008: Support mouse lock in Flash fullscreen mode. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/renderer/render_view_mouse_lock_dispatcher.h"
6
7 #include "content/common/view_messages.h"
8 #include "content/renderer/render_view_impl.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWidget.h"
12
13 RenderViewMouseLockDispatcher::RenderViewMouseLockDispatcher(
14 RenderViewImpl* render_view_impl)
15 : content::RenderViewObserver(render_view_impl),
16 render_view_impl_(render_view_impl) {
17 }
18
19 RenderViewMouseLockDispatcher::~RenderViewMouseLockDispatcher() {
20 }
21
22 void RenderViewMouseLockDispatcher::SendLockMouseRequest(
23 bool unlocked_by_target) {
24 bool user_gesture =
25 render_view_impl_->webview() &&
26 render_view_impl_->webview()->mainFrame() &&
27 render_view_impl_->webview()->mainFrame()->isProcessingUserGesture();
28
29 Send(new ViewHostMsg_LockMouse(routing_id(), user_gesture, unlocked_by_target,
30 false));
31 }
32
33 void RenderViewMouseLockDispatcher::SendUnlockMouseRequest() {
34 Send(new ViewHostMsg_UnlockMouse(routing_id()));
35 }
36
37 bool RenderViewMouseLockDispatcher::OnMessageReceived(
38 const IPC::Message& message) {
39 bool handled = true;
40 IPC_BEGIN_MESSAGE_MAP(RenderViewMouseLockDispatcher, message)
41 IPC_MESSAGE_HANDLER(ViewMsg_LockMouse_ACK, OnMsgLockMouseACK)
42 IPC_MESSAGE_FORWARD(ViewMsg_MouseLockLost,
43 static_cast<MouseLockDispatcher*>(this),
44 MouseLockDispatcher::OnMouseLockLost)
45 IPC_MESSAGE_UNHANDLED(handled = false)
46 IPC_END_MESSAGE_MAP()
47 return handled;
48 }
49
50 void RenderViewMouseLockDispatcher::OnMsgLockMouseACK(bool succeeded) {
51 // Notify the base class.
52 OnLockMouseACK(succeeded);
53
54 // Mouse Lock removes the system cursor and provides all mouse motion as
55 // .movementX/Y values on events all sent to a fixed target. This requires
56 // content to specifically request the mode to be entered.
57 // Mouse Capture is implicitly given for the duration of a drag event, and
58 // sends all mouse events to the initial target of the drag.
59 // If Lock is entered it supercedes any in progress Capture.
60 if (succeeded && render_view_impl_->webwidget())
61 render_view_impl_->webwidget()->mouseCaptureLost();
62 }
OLDNEW
« no previous file with comments | « content/renderer/render_view_mouse_lock_dispatcher.h ('k') | content/renderer/render_widget_fullscreen_pepper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698