| 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 <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 GtkWidget* gtk_widget = widget->GetNativeView(); | 285 GtkWidget* gtk_widget = widget->GetNativeView(); |
| 286 g_signal_connect(gtk_widget, "configure-event", | 286 g_signal_connect(gtk_widget, "configure-event", |
| 287 G_CALLBACK(&OnConfigure), widget); | 287 G_CALLBACK(&OnConfigure), widget); |
| 288 MessageLoop::current()->Run(); | 288 MessageLoop::current()->Run(); |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 #endif | 291 #endif |
| 292 | 292 |
| 293 void MoveMouseToCenterAndPress(views::View* view, MouseButton button, | 293 void MoveMouseToCenterAndPress(views::View* view, MouseButton button, |
| 294 int state, const base::Closure& task) { | 294 int state, const base::Closure& task) { |
| 295 #if defined(OS_LINUX) && !defined(USE_AURA) | 295 #if defined(OS_LINUX) |
| 296 // X is asynchronous and we need to wait until the window gets | 296 // X is asynchronous and we need to wait until the window gets |
| 297 // resized to desired size. | 297 // resized to desired size. |
| 298 SynchronizeWidgetSize(view->GetWidget()); | 298 SynchronizeWidgetSize(view->GetWidget()); |
| 299 #endif | 299 #endif |
| 300 | 300 |
| 301 gfx::Point view_center(view->width() / 2, view->height() / 2); | 301 gfx::Point view_center(view->width() / 2, view->height() / 2); |
| 302 views::View::ConvertPointToScreen(view, &view_center); | 302 views::View::ConvertPointToScreen(view, &view_center); |
| 303 SendMouseMoveNotifyWhenDone( | 303 SendMouseMoveNotifyWhenDone( |
| 304 view_center.x(), view_center.y(), | 304 view_center.x(), view_center.y(), |
| 305 base::Bind(&ui_controls::ClickTask, button, state, task)); | 305 base::Bind(&ui_controls::ClickTask, button, state, task)); |
| 306 } | 306 } |
| 307 #else | 307 #else |
| 308 void MoveMouseToCenterAndPress(GtkWidget* widget, | 308 void MoveMouseToCenterAndPress(GtkWidget* widget, |
| 309 MouseButton button, | 309 MouseButton button, |
| 310 int state, | 310 int state, |
| 311 const base::Closure& task) { | 311 const base::Closure& task) { |
| 312 gfx::Rect bounds = gtk_util::GetWidgetScreenBounds(widget); | 312 gfx::Rect bounds = gtk_util::GetWidgetScreenBounds(widget); |
| 313 SendMouseMoveNotifyWhenDone( | 313 SendMouseMoveNotifyWhenDone( |
| 314 bounds.x() + bounds.width() / 2, | 314 bounds.x() + bounds.width() / 2, |
| 315 bounds.y() + bounds.height() / 2, | 315 bounds.y() + bounds.height() / 2, |
| 316 base::Bind(&ui_controls::ClickTask, button, state, task)); | 316 base::Bind(&ui_controls::ClickTask, button, state, task)); |
| 317 } | 317 } |
| 318 #endif | 318 #endif |
| 319 | 319 |
| 320 } // namespace ui_controls | 320 } // namespace ui_controls |
| OLD | NEW |