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/mouse_lock_dispatcher.h" | 5 #include "content/renderer/mouse_lock_dispatcher.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "third_party/WebKit/public/web/WebInputEvent.h" | 8 #include "third_party/WebKit/public/web/WebInputEvent.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 UnlockMouse(target); | 51 UnlockMouse(target); |
52 target_ = NULL; | 52 target_ = NULL; |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 bool MouseLockDispatcher::IsMouseLockedTo(LockTarget* target) { | 56 bool MouseLockDispatcher::IsMouseLockedTo(LockTarget* target) { |
57 return mouse_locked_ && target_ == target; | 57 return mouse_locked_ && target_ == target; |
58 } | 58 } |
59 | 59 |
60 bool MouseLockDispatcher::WillHandleMouseEvent( | 60 bool MouseLockDispatcher::WillHandleMouseEvent( |
61 const WebKit::WebMouseEvent& event) { | 61 const blink::WebMouseEvent& event) { |
62 if (mouse_locked_ && target_) | 62 if (mouse_locked_ && target_) |
63 return target_->HandleMouseLockedInputEvent(event); | 63 return target_->HandleMouseLockedInputEvent(event); |
64 return false; | 64 return false; |
65 } | 65 } |
66 | 66 |
67 void MouseLockDispatcher::OnLockMouseACK(bool succeeded) { | 67 void MouseLockDispatcher::OnLockMouseACK(bool succeeded) { |
68 DCHECK(!mouse_locked_ && pending_lock_request_); | 68 DCHECK(!mouse_locked_ && pending_lock_request_); |
69 | 69 |
70 mouse_locked_ = succeeded; | 70 mouse_locked_ = succeeded; |
71 pending_lock_request_ = false; | 71 pending_lock_request_ = false; |
(...skipping 25 matching lines...) Expand all Loading... |
97 target_ = NULL; | 97 target_ = NULL; |
98 | 98 |
99 // Callbacks made after all state modification to prevent reentrant errors | 99 // Callbacks made after all state modification to prevent reentrant errors |
100 // such as OnMouseLockLost() synchronously calling LockMouse(). | 100 // such as OnMouseLockLost() synchronously calling LockMouse(). |
101 | 101 |
102 if (last_target) | 102 if (last_target) |
103 last_target->OnMouseLockLost(); | 103 last_target->OnMouseLockLost(); |
104 } | 104 } |
105 | 105 |
106 } // namespace content | 106 } // namespace content |
OLD | NEW |