Index: chrome/browser/automation/ui_controls_aurax11.cc |
diff --git a/chrome/browser/automation/ui_controls_aurax11.cc b/chrome/browser/automation/ui_controls_aurax11.cc |
index d7dbe697961a6101e6581ae520d0ed0b11fb2ba4..20c4c17e15296edc01d9405a7434cd3f9382e5be 100644 |
--- a/chrome/browser/automation/ui_controls_aurax11.cc |
+++ b/chrome/browser/automation/ui_controls_aurax11.cc |
@@ -70,22 +70,6 @@ bool Matcher(const base::NativeEvent& event) { |
event->xclient.message_type == MarkerEventAtom(); |
} |
-void RunClosureAfterEvents(const base::Closure closure) { |
- if (closure.is_null()) |
- return; |
- static XEvent* marker_event = NULL; |
- if (!marker_event) { |
- marker_event = new XEvent(); |
- marker_event->xclient.type = ClientMessage; |
- marker_event->xclient.display = NULL; |
- marker_event->xclient.window = None; |
- marker_event->xclient.format = 8; |
- } |
- marker_event->xclient.message_type = MarkerEventAtom(); |
- aura::Desktop::GetInstance()->PostNativeEvent(marker_event); |
- new EventWaiter(closure, &Matcher); |
-} |
- |
} // namespace |
namespace ui_controls { |
@@ -133,9 +117,7 @@ bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, |
SetMaskAndKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); |
if (alt) |
SetMaskAndKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L); |
- xevent.xkey.keycode = |
- XKeysymToKeycode(base::MessagePumpX::GetDefaultXDisplay(), |
- ui::XKeysymForWindowsKeyCode(key, shift)); |
+ xevent.xkey.keycode = ui::XKeysymForWindowsKeyCode(key, shift); |
aura::Desktop::GetInstance()->PostNativeEvent(&xevent); |
// Send key release events. |
@@ -148,7 +130,7 @@ bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, |
if (control) |
SetKeycodeAndSendThenUnmask(&xevent, ControlMask, XK_Control_L); |
DCHECK(!xevent.xkey.state); |
- RunClosureAfterEvents(closure); |
+ RunClosureAfterAllPendingUIEvents(closure); |
return true; |
} |
@@ -165,7 +147,7 @@ bool SendMouseMoveNotifyWhenDone(long x, long y, const base::Closure& closure) { |
xmotion->same_screen = True; |
// Desktop will take care of other necessary fields. |
aura::Desktop::GetInstance()->PostNativeEvent(&xevent); |
- RunClosureAfterEvents(closure); |
+ RunClosureAfterAllPendingUIEvents(closure); |
return false; |
} |
@@ -208,7 +190,7 @@ bool SendMouseEventsNotifyWhenDone(MouseButton type, |
xevent.xbutton.type = ButtonRelease; |
desktop->PostNativeEvent(&xevent); |
} |
- RunClosureAfterEvents(closure); |
+ RunClosureAfterAllPendingUIEvents(closure); |
return false; |
} |
@@ -226,4 +208,20 @@ void MoveMouseToCenterAndPress(views::View* view, MouseButton button, |
SendMouseEventsNotifyWhenDone(button, state, closure); |
} |
+void RunClosureAfterAllPendingUIEvents(const base::Closure& closure) { |
+ if (closure.is_null()) |
+ return; |
+ static XEvent* marker_event = NULL; |
+ if (!marker_event) { |
+ marker_event = new XEvent(); |
+ marker_event->xclient.type = ClientMessage; |
+ marker_event->xclient.display = NULL; |
+ marker_event->xclient.window = None; |
+ marker_event->xclient.format = 8; |
+ } |
+ marker_event->xclient.message_type = MarkerEventAtom(); |
+ aura::Desktop::GetInstance()->PostNativeEvent(marker_event); |
+ new EventWaiter(closure, &Matcher); |
+} |
+ |
} // namespace ui_controls |