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

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

Issue 10512011: Only set MouseLockDispatcher unlocked_by_target_ after mouse lock confirmed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | 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/mouse_lock_dispatcher.h" 5 #include "content/renderer/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/WebInputEvent.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
(...skipping 26 matching lines...) Expand all
37 Send(new ViewHostMsg_LockMouse(routing_id(), 37 Send(new ViewHostMsg_LockMouse(routing_id(),
38 user_gesture, 38 user_gesture,
39 unlocked_by_target_)); 39 unlocked_by_target_));
40 unlocked_by_target_ = false; 40 unlocked_by_target_ = false;
41 return true; 41 return true;
42 } 42 }
43 43
44 void MouseLockDispatcher::UnlockMouse(LockTarget* target) { 44 void MouseLockDispatcher::UnlockMouse(LockTarget* target) {
45 if (target && target == target_ && !pending_unlock_request_) { 45 if (target && target == target_ && !pending_unlock_request_) {
46 pending_unlock_request_ = true; 46 pending_unlock_request_ = true;
47 unlocked_by_target_ = true; 47
48 // When a target application voluntarily unlocks the mouse we permit
yzshen1 2012/06/04 21:40:30 [I don't know the exact answer, but would like to
scheib 2012/06/04 23:25:40 I considered this when designing the first patch.
49 // relocking the mouse silently and with no user gesture requirement.
50 // Check that the lock request is not currently pending and not yet
51 // accepted by the browser process before setting |unlocked_by_target_|.
52 if (!pending_lock_request_)
53 unlocked_by_target_ = true;
54
48 Send(new ViewHostMsg_UnlockMouse(routing_id())); 55 Send(new ViewHostMsg_UnlockMouse(routing_id()));
49 } 56 }
50 } 57 }
51 58
52 void MouseLockDispatcher::OnLockTargetDestroyed(LockTarget* target) { 59 void MouseLockDispatcher::OnLockTargetDestroyed(LockTarget* target) {
53 if (target == target_) { 60 if (target == target_) {
54 UnlockMouse(target); 61 UnlockMouse(target);
55 target_ = NULL; 62 target_ = NULL;
56 } 63 }
57 } 64 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 124
118 LockTarget* last_target = target_; 125 LockTarget* last_target = target_;
119 target_ = NULL; 126 target_ = NULL;
120 127
121 // Callbacks made after all state modification to prevent reentrant errors 128 // Callbacks made after all state modification to prevent reentrant errors
122 // such as OnMouseLockLost() synchronously calling LockMouse(). 129 // such as OnMouseLockLost() synchronously calling LockMouse().
123 130
124 if (last_target) 131 if (last_target)
125 last_target->OnMouseLockLost(); 132 last_target->OnMouseLockLost();
126 } 133 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698