diff options
author | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 11:31:34 +0000 |
---|---|---|
committer | joi@chromium.org <joi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-06 11:31:34 +0000 |
commit | 05d03036e86ecc519029ac726ae6322a4fd32c6a (patch) | |
tree | 2849513a0ff6644868958ebcfa942934705c6020 /chrome/browser | |
parent | e92569c290d66d9f0f2e3cb40f08d918637b637e (diff) | |
download | chromium_src-05d03036e86ecc519029ac726ae6322a4fd32c6a.zip chromium_src-05d03036e86ecc519029ac726ae6322a4fd32c6a.tar.gz chromium_src-05d03036e86ecc519029ac726ae6322a4fd32c6a.tar.bz2 |
Revert 113177 - process all ui events before posting closure because menu depends on ui events to quit.
Add new RunClosureAfterAllPendingUIEvents for toolkit views.
BUG=104359
TEST=BookmarkBarViewTest in interactive_ui_tests will pass
Review URL: http://codereview.chromium.org/8799020
Reason for revert: http://build.chromium.org/p/chromium.chromiumos/builders/Linux%20ChromeOS%20Aura/builds/1514
TBR=oshima@chromium.org
Review URL: http://codereview.chromium.org/8821012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/automation/ui_controls.h | 5 | ||||
-rw-r--r-- | chrome/browser/automation/ui_controls_aurawin.cc | 6 | ||||
-rw-r--r-- | chrome/browser/automation/ui_controls_aurax11.cc | 42 | ||||
-rw-r--r-- | chrome/browser/automation/ui_controls_gtk.cc | 9 | ||||
-rw-r--r-- | chrome/browser/automation/ui_controls_internal.h | 1 | ||||
-rw-r--r-- | chrome/browser/automation/ui_controls_win.cc | 6 |
6 files changed, 22 insertions, 47 deletions
diff --git a/chrome/browser/automation/ui_controls.h b/chrome/browser/automation/ui_controls.h index 270e18d..19e215a 100644 --- a/chrome/browser/automation/ui_controls.h +++ b/chrome/browser/automation/ui_controls.h @@ -97,11 +97,6 @@ void MoveMouseToCenterAndPress( int state, const base::Closure& task); -#if defined(TOOLKIT_VIEWS) -// Runs |closure| after processing all pending ui events. -void RunClosureAfterAllPendingUIEvents(const base::Closure& closure); -#endif - } // ui_controls #endif // CHROME_BROWSER_AUTOMATION_UI_CONTROLS_H_ diff --git a/chrome/browser/automation/ui_controls_aurawin.cc b/chrome/browser/automation/ui_controls_aurawin.cc index 31c92b4..50e5f87 100644 --- a/chrome/browser/automation/ui_controls_aurawin.cc +++ b/chrome/browser/automation/ui_controls_aurawin.cc @@ -5,7 +5,6 @@ #include "chrome/browser/automation/ui_controls.h" #include "base/logging.h" -#include "base/message_loop.h" #include "chrome/browser/automation/ui_controls_internal.h" #include "ui/aura/desktop.h" #include "ui/views/view.h" @@ -70,9 +69,4 @@ void MoveMouseToCenterAndPress(views::View* view, SendMouseEventsNotifyWhenDone(button, state, task); } -void RunClosureAfterAllPendingUIEvents(const base::Closure& task) { - // On windows, posting UI events is synchronous so just post the closure. - MessageLoopForUI::current()->PostTask(FROM_HERE, task); -} - } // namespace ui_controls diff --git a/chrome/browser/automation/ui_controls_aurax11.cc b/chrome/browser/automation/ui_controls_aurax11.cc index 20c4c17..d7dbe69 100644 --- a/chrome/browser/automation/ui_controls_aurax11.cc +++ b/chrome/browser/automation/ui_controls_aurax11.cc @@ -70,6 +70,22 @@ 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 { @@ -117,7 +133,9 @@ bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, SetMaskAndKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); if (alt) SetMaskAndKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L); - xevent.xkey.keycode = ui::XKeysymForWindowsKeyCode(key, shift); + xevent.xkey.keycode = + XKeysymToKeycode(base::MessagePumpX::GetDefaultXDisplay(), + ui::XKeysymForWindowsKeyCode(key, shift)); aura::Desktop::GetInstance()->PostNativeEvent(&xevent); // Send key release events. @@ -130,7 +148,7 @@ bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, if (control) SetKeycodeAndSendThenUnmask(&xevent, ControlMask, XK_Control_L); DCHECK(!xevent.xkey.state); - RunClosureAfterAllPendingUIEvents(closure); + RunClosureAfterEvents(closure); return true; } @@ -147,7 +165,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); - RunClosureAfterAllPendingUIEvents(closure); + RunClosureAfterEvents(closure); return false; } @@ -190,7 +208,7 @@ bool SendMouseEventsNotifyWhenDone(MouseButton type, xevent.xbutton.type = ButtonRelease; desktop->PostNativeEvent(&xevent); } - RunClosureAfterAllPendingUIEvents(closure); + RunClosureAfterEvents(closure); return false; } @@ -208,20 +226,4 @@ 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 diff --git a/chrome/browser/automation/ui_controls_gtk.cc b/chrome/browser/automation/ui_controls_gtk.cc index 8826609..32e3100 100644 --- a/chrome/browser/automation/ui_controls_gtk.cc +++ b/chrome/browser/automation/ui_controls_gtk.cc @@ -310,13 +310,4 @@ void MoveMouseToCenterAndPress(GtkWidget* widget, } #endif -#if defined(TOOLKIT_VIEWS) -void RunClosureAfterAllPendingUIEvents(const base::Closure& task) { - // Send noop event and run task. - int x, y; - gdk_window_at_pointer(&x, &y); - SendMouseMoveNotifyWhenDone(x, y, task); -} -#endif - } // namespace ui_controls diff --git a/chrome/browser/automation/ui_controls_internal.h b/chrome/browser/automation/ui_controls_internal.h index e0f5a78..cf87d49 100644 --- a/chrome/browser/automation/ui_controls_internal.h +++ b/chrome/browser/automation/ui_controls_internal.h @@ -27,7 +27,6 @@ bool SendMouseMoveImpl(long x, long y, const base::Closure& task); bool SendMouseEventsImpl(MouseButton type, int state, const base::Closure& task); -void RunClosureAfterAllPendingUITasksImpl(const base::Closure& task); #endif } // namespace internal diff --git a/chrome/browser/automation/ui_controls_win.cc b/chrome/browser/automation/ui_controls_win.cc index 744928f..5d2c873 100644 --- a/chrome/browser/automation/ui_controls_win.cc +++ b/chrome/browser/automation/ui_controls_win.cc @@ -5,7 +5,6 @@ #include "chrome/browser/automation/ui_controls.h" #include "base/callback.h" -#include "base/message_loop.h" #include "chrome/browser/automation/ui_controls_internal.h" #include "ui/gfx/point.h" #include "ui/views/view.h" @@ -66,9 +65,4 @@ void MoveMouseToCenterAndPress(views::View* view, SendMouseEventsNotifyWhenDone(button, state, task); } -void RunClosureAfterAllPendingUIEvents(const base::Closure& closure) { - // On windows, posting UI events is synchronous so just post the closure. - MessageLoopForUI::current()->PostTask(FROM_HERE, closure); -} - } // ui_controls |