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

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

Issue 2915613004: [PointerLock] Move "silent mouse lock" logic from renderer to RWHI (Closed)
Patch Set: jochen's comment: Remove 'const' before local bool Created 3 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
« no previous file with comments | « content/public/test/browser_test_utils.cc ('k') | content/renderer/mouse_lock_dispatcher.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 #ifndef CONTENT_RENDERER_MOUSE_LOCK_DISPATCHER_H_ 5 #ifndef CONTENT_RENDERER_MOUSE_LOCK_DISPATCHER_H_
6 #define CONTENT_RENDERER_MOUSE_LOCK_DISPATCHER_H_ 6 #define CONTENT_RENDERER_MOUSE_LOCK_DISPATCHER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "content/common/content_export.h" 9 #include "content/common/content_export.h"
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 bool WillHandleMouseEvent(const blink::WebMouseEvent& event); 46 bool WillHandleMouseEvent(const blink::WebMouseEvent& event);
47 47
48 // Subclasses or users have to call these methods to report mouse lock events 48 // Subclasses or users have to call these methods to report mouse lock events
49 // from the browser. 49 // from the browser.
50 void OnLockMouseACK(bool succeeded); 50 void OnLockMouseACK(bool succeeded);
51 void OnMouseLockLost(); 51 void OnMouseLockLost();
52 52
53 protected: 53 protected:
54 // Subclasses must implement these methods to send mouse lock requests to the 54 // Subclasses must implement these methods to send mouse lock requests to the
55 // browser. 55 // browser.
56 virtual void SendLockMouseRequest(bool unlocked_by_target) = 0; 56 virtual void SendLockMouseRequest() = 0;
57 virtual void SendUnlockMouseRequest() = 0; 57 virtual void SendUnlockMouseRequest() = 0;
58 58
59 private: 59 private:
60 bool MouseLockedOrPendingAction() const { 60 bool MouseLockedOrPendingAction() const {
61 return mouse_locked_ || pending_lock_request_ || pending_unlock_request_; 61 return mouse_locked_ || pending_lock_request_ || pending_unlock_request_;
62 } 62 }
63 63
64 bool mouse_locked_; 64 bool mouse_locked_;
65 // If both |pending_lock_request_| and |pending_unlock_request_| are true, 65 // If both |pending_lock_request_| and |pending_unlock_request_| are true,
66 // it means a lock request was sent before an unlock request and we haven't 66 // it means a lock request was sent before an unlock request and we haven't
67 // received responses for them. The logic in LockMouse() makes sure that a 67 // received responses for them. The logic in LockMouse() makes sure that a
68 // lock request won't be sent when there is a pending unlock request. 68 // lock request won't be sent when there is a pending unlock request.
69 bool pending_lock_request_; 69 bool pending_lock_request_;
70 bool pending_unlock_request_; 70 bool pending_unlock_request_;
71 71
72 // Used when locking to indicate when a target application has voluntarily
73 // unlocked and desires to relock the mouse. If the mouse is unlocked due
74 // to ESC being pressed by the user, this will be false
75 bool unlocked_by_target_;
76
77 // |target_| is the pending or current owner of mouse lock. We retain a non 72 // |target_| is the pending or current owner of mouse lock. We retain a non
78 // owning reference here that must be cleared by |OnLockTargetDestroyed| 73 // owning reference here that must be cleared by |OnLockTargetDestroyed|
79 // when it is destroyed. 74 // when it is destroyed.
80 LockTarget* target_; 75 LockTarget* target_;
81 76
82 DISALLOW_COPY_AND_ASSIGN(MouseLockDispatcher); 77 DISALLOW_COPY_AND_ASSIGN(MouseLockDispatcher);
83 }; 78 };
84 79
85 } // namespace content 80 } // namespace content
86 81
87 #endif // CONTENT_RENDERER_MOUSE_LOCK_DISPATCHER_H_ 82 #endif // CONTENT_RENDERER_MOUSE_LOCK_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/public/test/browser_test_utils.cc ('k') | content/renderer/mouse_lock_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698