Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(955)

Unified Diff: chrome/browser/automation/ui_controls_gtk.cc

Issue 8212006: base::Bind: Cleanup in automation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Build fixes 1. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/automation/ui_controls_gtk.cc
diff --git a/chrome/browser/automation/ui_controls_gtk.cc b/chrome/browser/automation/ui_controls_gtk.cc
index db52ea26b83cffb7f6d5dd506200fd133bc636a3..8a5e3d9c50e5194bbb21510259dd215b93cc52b9 100644
--- a/chrome/browser/automation/ui_controls_gtk.cc
+++ b/chrome/browser/automation/ui_controls_gtk.cc
@@ -31,7 +31,7 @@ guint32 XTimeNow() {
class EventWaiter : public MessageLoopForUI::Observer {
public:
- EventWaiter(Task* task, GdkEventType type, int count)
+ EventWaiter(const base::Closure& task, GdkEventType type, int count)
: task_(task),
type_(type),
count_(count) {
@@ -71,9 +71,7 @@ class EventWaiter : public MessageLoopForUI::Observer {
#endif
private:
- // We pass ownership of task_ to MessageLoop when the current event is
- // received.
- Task* task_;
+ base::Closure task_;
GdkEventType type_;
// The number of events of this type to wait for.
int count_;
@@ -161,7 +159,7 @@ bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
bool shift,
bool alt,
bool command,
- Task* task) {
+ const base::Closure& task) {
DCHECK(!command); // No command key on Linux
int release_count = 1;
if (control)
@@ -185,7 +183,7 @@ bool SendMouseMove(long x, long y) {
return true;
}
-bool SendMouseMoveNotifyWhenDone(long x, long y, Task* task) {
+bool SendMouseMoveNotifyWhenDone(long x, long y, const base::Closure& task) {
bool rv = SendMouseMove(x, y);
new EventWaiter(task, GDK_MOTION_NOTIFY, 1);
return rv;
@@ -241,7 +239,8 @@ bool SendMouseEvents(MouseButton type, int state) {
return false;
}
-bool SendMouseEventsNotifyWhenDone(MouseButton type, int state, Task* task) {
+bool SendMouseEventsNotifyWhenDone(MouseButton type, int state,
+ const base::Closure& task) {
bool rv = SendMouseEvents(type, state);
GdkEventType wait_type;
if (state & UP) {
@@ -291,7 +290,7 @@ void SynchronizeWidgetSize(views::Widget* widget) {
#endif
void MoveMouseToCenterAndPress(views::View* view, MouseButton button,
- int state, Task* task) {
+ int state, const base::Closure& task) {
#if defined(OS_LINUX) && !defined(USE_AURA)
// X is asynchronous and we need to wait until the window gets
// resized to desired size.
@@ -301,17 +300,17 @@ void MoveMouseToCenterAndPress(views::View* view, MouseButton button,
gfx::Point view_center(view->width() / 2, view->height() / 2);
views::View::ConvertPointToScreen(view, &view_center);
SendMouseMoveNotifyWhenDone(view_center.x(), view_center.y(),
- new ClickTask(button, state, task));
+ ClickTask(button, state, task));
}
#else
void MoveMouseToCenterAndPress(GtkWidget* widget,
MouseButton button,
int state,
- Task* task) {
+ const base::Closure& task) {
gfx::Rect bounds = gtk_util::GetWidgetScreenBounds(widget);
SendMouseMoveNotifyWhenDone(bounds.x() + bounds.width() / 2,
bounds.y() + bounds.height() / 2,
- new ClickTask(button, state, task));
+ ClickTask(button, state, task));
}
#endif

Powered by Google App Engine
This is Rietveld 408576698