| 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 if (dispatcher.get()) | 288 if (dispatcher.get()) |
| 289 dispatcher->AddRef(); | 289 dispatcher->AddRef(); |
| 290 | 290 |
| 291 return true; | 291 return true; |
| 292 } | 292 } |
| 293 | 293 |
| 294 } // namespace | 294 } // namespace |
| 295 | 295 |
| 296 // public functions ----------------------------------------------------------- | 296 // public functions ----------------------------------------------------------- |
| 297 | 297 |
| 298 bool SendKeyPress(wchar_t key, bool control, bool shift, bool alt) { | 298 bool SendKeyPress(gfx::NativeWindow window, wchar_t key, bool control, |
| 299 bool shift, bool alt) { |
| 299 return SendKeyPressImpl(key, control, shift, alt, NULL); | 300 return SendKeyPressImpl(key, control, shift, alt, NULL); |
| 300 } | 301 } |
| 301 | 302 |
| 302 bool SendKeyPressNotifyWhenDone(wchar_t key, bool control, bool shift, | 303 bool SendKeyPressNotifyWhenDone(wchar_t key, bool control, bool shift, |
| 303 bool alt, Task* task) { | 304 bool alt, Task* task) { |
| 304 return SendKeyPressImpl(key, control, shift, alt, task); | 305 return SendKeyPressImpl(key, control, shift, alt, task); |
| 305 } | 306 } |
| 306 | 307 |
| 307 bool SendKeyDown(wchar_t key) { | 308 bool SendKeyDown(wchar_t key) { |
| 308 return SendKeyEvent(key, false); | 309 return SendKeyEvent(key, false); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 321 } | 322 } |
| 322 | 323 |
| 323 bool SendMouseEvents(MouseButton type, int state) { | 324 bool SendMouseEvents(MouseButton type, int state) { |
| 324 return SendMouseEventsImpl(type, state, NULL); | 325 return SendMouseEventsImpl(type, state, NULL); |
| 325 } | 326 } |
| 326 | 327 |
| 327 void SendMouseEventsNotifyWhenDone(MouseButton type, int state, Task* task) { | 328 void SendMouseEventsNotifyWhenDone(MouseButton type, int state, Task* task) { |
| 328 SendMouseEventsImpl(type, state, task); | 329 SendMouseEventsImpl(type, state, task); |
| 329 } | 330 } |
| 330 | 331 |
| 331 bool SendMouseClick(MouseButton type) { | 332 bool SendMouseClick(gfx::NativeWindow window, const gfx::Point& point, |
| 333 MouseButton type) { |
| 332 return SendMouseEventsImpl(type, UP | DOWN, NULL); | 334 return SendMouseEventsImpl(type, UP | DOWN, NULL); |
| 333 } | 335 } |
| 334 | 336 |
| 335 void MoveMouseToCenterAndPress(views::View* view, MouseButton button, | 337 void MoveMouseToCenterAndPress(views::View* view, MouseButton button, |
| 336 int state, Task* task) { | 338 int state, Task* task) { |
| 337 DCHECK(view); | 339 DCHECK(view); |
| 338 DCHECK(view->GetWidget()); | 340 DCHECK(view->GetWidget()); |
| 339 gfx::Point view_center(view->width() / 2, view->height() / 2); | 341 gfx::Point view_center(view->width() / 2, view->height() / 2); |
| 340 views::View::ConvertPointToScreen(view, &view_center); | 342 views::View::ConvertPointToScreen(view, &view_center); |
| 341 SendMouseMove(view_center.x(), view_center.y()); | 343 SendMouseMove(view_center.x(), view_center.y()); |
| 342 SendMouseEventsNotifyWhenDone(button, state, task); | 344 SendMouseEventsNotifyWhenDone(button, state, task); |
| 343 } | 345 } |
| 344 | 346 |
| 345 } // ui_controls | 347 } // ui_controls |
| OLD | NEW |