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

Side by Side Diff: content/renderer/mouse_lock_dispatcher.h

Issue 8970016: refactoring mouse lock to support pepper and WebKit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated webkit API names. Created 8 years, 11 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) 2011 The Chromium Authors. All rights reserved.
yzshen1 2012/01/16 07:50:35 2012. (Yes, apocalypse is very close now. :))
scheib 2012/01/17 22:05:36 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MOUSE_LOCK_DISPATCHER_H_
yzshen1 2012/01/16 07:50:35 You should list the full path.
scheib 2012/01/17 22:05:36 Done.
6 #define MOUSE_LOCK_DISPATCHER_H_
7 #pragma once
8
9 #include "content/public/renderer/render_view_observer.h"
10
11 class RenderViewImpl;
12 class WebMouseEvent;
yzshen1 2012/01/16 07:50:35 It is in WebKit namespace.
scheib 2012/01/17 22:05:36 Done.
13
14 namespace WebKit {
15 class WebWidget;
16 } // namespace WebKit
17
18 namespace webkit{
19 namespace ppapi {
20 class PluginInstance;
21 } // namespace ppapi
22 } // namespace webkit
23
24 // MouseLockDispatcherDispatcher is owned by RenderViewImpl.
yzshen1 2012/01/16 07:50:35 One redundant Dispatcher.
scheib 2012/01/17 22:05:36 Done.
25 class MouseLockDispatcher : public content::RenderViewObserver {
26 public:
27 explicit MouseLockDispatcher(RenderViewImpl* render_view_impl);
28 virtual ~MouseLockDispatcher();
29
30 bool LockMouse(WebKit::WebWidget* webwidget,
yzshen1 2012/01/16 07:50:35 It is better to have the same interface for webwid
scheib 2012/01/17 22:05:36 I started that way, and showed darin. He did not l
yzshen1 2012/01/17 23:39:25 Okay, if that has been carefully considered. Plea
scheib 2012/01/18 17:54:58 We did consider an adapter as well, but that would
31 webkit::ppapi::PluginInstance* pinstance);
32 void UnlockMouse(WebKit::WebWidget* webwidget,
33 webkit::ppapi::PluginInstance* pinstance);
34 bool IsPointerLockedTo(WebKit::WebWidget* webwidget);
35 bool IsMouseLockedTo(webkit::ppapi::PluginInstance* pinstance);
36 bool WillHandleMouseEvent(const WebKit::WebMouseEvent& event);
37
38 private:
39 // RenderView::Observer implementation.
40 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
41
42 // IPC handlers.
43 void OnLockMouseACK(bool succeeded);
44 void OnMouseLockLost();
45
46
yzshen1 2012/01/16 07:50:35 One empty line is enough.
scheib 2012/01/17 22:05:36 Done.
47 bool MouseLockedOrPendingAction() const {
48 return mouse_locked_ || pending_lock_request_ || pending_unlock_request_;
49 }
50
51 RenderViewImpl* render_view_impl_;
52
53 bool mouse_locked_;
54 // If both |pending_lock_request_| and |pending_unlock_request_| are true,
55 // it means a lock request was sent before an unlock request and we haven't
56 // received responses for them.
57 // The logic in LockMouse() makes sure that a lock request won't be sent when
58 // there is a pending unlock request.
59 bool pending_lock_request_;
60 bool pending_unlock_request_;
61
62 // |mouse_lock_webwidget_owner_| and |mouse_lock_pinstance_owner_|
63 // are not owned by this class.
64 // If they are non-NULL it doesn't indicate that the
65 // mouse has been locked. It is possible that a request to lock the mouse has
66 // been sent, but the response hasn't arrived yet.
67 WebKit::WebWidget* mouse_lock_webwidget_owner_;
68 webkit::ppapi::PluginInstance* mouse_lock_pinstance_owner_;
69
70 DISALLOW_COPY_AND_ASSIGN(MouseLockDispatcher);
yzshen1 2012/01/16 07:50:35 You should include .h for DISALLOW_COPY_AND_ASSIGN
scheib 2012/01/17 22:05:36 Done.
71 };
72
73 #endif // MOUSE_LOCK_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698