OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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" | 8 #include "base/message_loop.h" |
9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 bool shift, bool alt) { | 299 bool shift, bool alt) { |
300 return SendKeyPressImpl(key, control, shift, alt, NULL); | 300 return SendKeyPressImpl(key, control, shift, alt, NULL); |
301 } | 301 } |
302 | 302 |
303 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, wchar_t key, | 303 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, wchar_t key, |
304 bool control, bool shift, | 304 bool control, bool shift, |
305 bool alt, Task* task) { | 305 bool alt, Task* task) { |
306 return SendKeyPressImpl(key, control, shift, alt, task); | 306 return SendKeyPressImpl(key, control, shift, alt, task); |
307 } | 307 } |
308 | 308 |
309 bool SendKeyDown(wchar_t key) { | |
310 return SendKeyEvent(key, false); | |
311 } | |
312 | |
313 bool SendKeyUp(wchar_t key) { | |
314 return SendKeyEvent(key, true); | |
315 } | |
316 | |
317 bool SendMouseMove(long x, long y) { | 309 bool SendMouseMove(long x, long y) { |
318 return SendMouseMoveImpl(x, y, NULL); | 310 return SendMouseMoveImpl(x, y, NULL); |
319 } | 311 } |
320 | 312 |
321 void SendMouseMoveNotifyWhenDone(long x, long y, Task* task) { | 313 bool SendMouseMoveNotifyWhenDone(long x, long y, Task* task) { |
322 SendMouseMoveImpl(x, y, task); | 314 return SendMouseMoveImpl(x, y, task); |
323 } | 315 } |
324 | 316 |
325 bool SendMouseEvents(MouseButton type, int state) { | 317 bool SendMouseEvents(MouseButton type, int state) { |
326 return SendMouseEventsImpl(type, state, NULL); | 318 return SendMouseEventsImpl(type, state, NULL); |
327 } | 319 } |
328 | 320 |
329 void SendMouseEventsNotifyWhenDone(MouseButton type, int state, Task* task) { | 321 void SendMouseEventsNotifyWhenDone(MouseButton type, int state, Task* task) { |
330 SendMouseEventsImpl(type, state, task); | 322 SendMouseEventsImpl(type, state, task); |
331 } | 323 } |
332 | 324 |
333 bool SendMouseClick(gfx::NativeWindow window, const gfx::Point& point, | 325 bool SendMouseClick(const gfx::Point& point, MouseButton type) { |
334 MouseButton type) { | |
335 return SendMouseEventsImpl(type, UP | DOWN, NULL); | 326 return SendMouseEventsImpl(type, UP | DOWN, NULL); |
336 } | 327 } |
337 | 328 |
338 void MoveMouseToCenterAndPress(views::View* view, MouseButton button, | 329 void MoveMouseToCenterAndPress(views::View* view, MouseButton button, |
339 int state, Task* task) { | 330 int state, Task* task) { |
340 DCHECK(view); | 331 DCHECK(view); |
341 DCHECK(view->GetWidget()); | 332 DCHECK(view->GetWidget()); |
342 gfx::Point view_center(view->width() / 2, view->height() / 2); | 333 gfx::Point view_center(view->width() / 2, view->height() / 2); |
343 views::View::ConvertPointToScreen(view, &view_center); | 334 views::View::ConvertPointToScreen(view, &view_center); |
344 SendMouseMove(view_center.x(), view_center.y()); | 335 SendMouseMove(view_center.x(), view_center.y()); |
345 SendMouseEventsNotifyWhenDone(button, state, task); | 336 SendMouseEventsNotifyWhenDone(button, state, task); |
346 } | 337 } |
347 | 338 |
348 } // ui_controls | 339 } // ui_controls |
OLD | NEW |