| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 | 9 |
| 10 #include "app/event_synthesis_gtk.h" | |
| 11 #include "gfx/rect.h" | 10 #include "gfx/rect.h" |
| 12 #include "base/logging.h" | 11 #include "base/logging.h" |
| 13 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 14 #include "chrome/browser/automation/ui_controls_internal.h" | 13 #include "chrome/browser/automation/ui_controls_internal.h" |
| 15 #include "chrome/browser/gtk/gtk_util.h" | 14 #include "chrome/browser/gtk/gtk_util.h" |
| 16 #include "chrome/common/automation_constants.h" | 15 #include "chrome/common/automation_constants.h" |
| 16 #include "ui/base/gtk/event_synthesis_gtk.h" |
| 17 | 17 |
| 18 #if defined(TOOLKIT_VIEWS) | 18 #if defined(TOOLKIT_VIEWS) |
| 19 #include "views/view.h" | 19 #include "views/view.h" |
| 20 #include "views/widget/widget.h" | 20 #include "views/widget/widget.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| 24 | 24 |
| 25 class EventWaiter : public MessageLoopForUI::Observer { | 25 class EventWaiter : public MessageLoopForUI::Observer { |
| 26 public: | 26 public: |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 g_list_free(windows); | 119 g_list_free(windows); |
| 120 } | 120 } |
| 121 if (!event_window) { | 121 if (!event_window) { |
| 122 NOTREACHED() << "Window not specified and none is active"; | 122 NOTREACHED() << "Window not specified and none is active"; |
| 123 return false; | 123 return false; |
| 124 } | 124 } |
| 125 | 125 |
| 126 std::vector<GdkEvent*> events; | 126 std::vector<GdkEvent*> events; |
| 127 app::SynthesizeKeyPressEvents(event_window, key, control, shift, alt, | 127 ui::SynthesizeKeyPressEvents(event_window, key, control, shift, alt, &events); |
| 128 &events); | |
| 129 for (std::vector<GdkEvent*>::iterator iter = events.begin(); | 128 for (std::vector<GdkEvent*>::iterator iter = events.begin(); |
| 130 iter != events.end(); ++iter) { | 129 iter != events.end(); ++iter) { |
| 131 gdk_event_put(*iter); | 130 gdk_event_put(*iter); |
| 132 // gdk_event_put appends a copy of the event. | 131 // gdk_event_put appends a copy of the event. |
| 133 gdk_event_free(*iter); | 132 gdk_event_free(*iter); |
| 134 } | 133 } |
| 135 | 134 |
| 136 return true; | 135 return true; |
| 137 } | 136 } |
| 138 | 137 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 int state, | 258 int state, |
| 260 Task* task) { | 259 Task* task) { |
| 261 gfx::Rect bounds = gtk_util::GetWidgetScreenBounds(widget); | 260 gfx::Rect bounds = gtk_util::GetWidgetScreenBounds(widget); |
| 262 SendMouseMoveNotifyWhenDone(bounds.x() + bounds.width() / 2, | 261 SendMouseMoveNotifyWhenDone(bounds.x() + bounds.width() / 2, |
| 263 bounds.y() + bounds.height() / 2, | 262 bounds.y() + bounds.height() / 2, |
| 264 new ClickTask(button, state, task)); | 263 new ClickTask(button, state, task)); |
| 265 } | 264 } |
| 266 #endif | 265 #endif |
| 267 | 266 |
| 268 } // namespace ui_controls | 267 } // namespace ui_controls |
| OLD | NEW |