| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/automation/ui_controls.h" | 5 #include "chrome/browser/automation/ui_controls.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | |
| 9 #include "chrome/browser/automation/ui_controls_internal.h" | 8 #include "chrome/browser/automation/ui_controls_internal.h" |
| 10 #include "ui/aura/desktop.h" | 9 #include "ui/aura/desktop.h" |
| 11 #include "ui/views/view.h" | 10 #include "ui/views/view.h" |
| 12 | 11 |
| 13 namespace ui_controls { | 12 namespace ui_controls { |
| 14 | 13 |
| 15 bool SendKeyPress(gfx::NativeWindow window, | 14 bool SendKeyPress(gfx::NativeWindow window, |
| 16 ui::KeyboardCode key, | 15 ui::KeyboardCode key, |
| 17 bool control, | 16 bool control, |
| 18 bool shift, | 17 bool shift, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 int state, | 62 int state, |
| 64 const base::Closure& task) { | 63 const base::Closure& task) { |
| 65 DCHECK(view); | 64 DCHECK(view); |
| 66 DCHECK(view->GetWidget()); | 65 DCHECK(view->GetWidget()); |
| 67 gfx::Point view_center(view->width() / 2, view->height() / 2); | 66 gfx::Point view_center(view->width() / 2, view->height() / 2); |
| 68 views::View::ConvertPointToScreen(view, &view_center); | 67 views::View::ConvertPointToScreen(view, &view_center); |
| 69 SendMouseMove(view_center.x(), view_center.y()); | 68 SendMouseMove(view_center.x(), view_center.y()); |
| 70 SendMouseEventsNotifyWhenDone(button, state, task); | 69 SendMouseEventsNotifyWhenDone(button, state, task); |
| 71 } | 70 } |
| 72 | 71 |
| 73 void RunClosureAfterAllPendingUIEvents(const base::Closure& task) { | |
| 74 // On windows, posting UI events is synchronous so just post the closure. | |
| 75 MessageLoopForUI::current()->PostTask(FROM_HERE, task); | |
| 76 } | |
| 77 | |
| 78 } // namespace ui_controls | 72 } // namespace ui_controls |
| OLD | NEW |