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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/automation/ui_controls_internal.h" | |
9 #include "ui/aura/desktop.h" | |
8 #include "views/view.h" | 10 #include "views/view.h" |
9 | 11 |
10 namespace ui_controls { | 12 namespace ui_controls { |
11 | 13 |
12 bool SendKeyPress(gfx::NativeWindow window, | 14 bool SendKeyPress(gfx::NativeWindow window, |
13 ui::KeyboardCode key, | 15 ui::KeyboardCode key, |
14 bool control, | 16 bool control, |
15 bool shift, | 17 bool shift, |
16 bool alt, | 18 bool alt, |
17 bool command) { | 19 bool command) { |
18 // http://crbug.com/104396 | 20 DCHECK(!command); // No command key on Aura |
19 NOTIMPLEMENTED(); | 21 return internal::SendKeyPressImpl(key, control, shift, alt, base::Closure()); |
20 return true; | |
21 } | 22 } |
22 | 23 |
23 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, | 24 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, |
24 ui::KeyboardCode key, | 25 ui::KeyboardCode key, |
25 bool control, | 26 bool control, |
26 bool shift, | 27 bool shift, |
27 bool alt, | 28 bool alt, |
28 bool command, | 29 bool command, |
29 const base::Closure& task) { | 30 const base::Closure& task) { |
30 // http://crbug.com/104396 | 31 DCHECK(!command); // No command key on Aura |
31 NOTIMPLEMENTED(); | 32 return internal::SendKeyPressImpl(key, control, shift, alt, task); |
32 return true; | |
33 } | 33 } |
34 | 34 |
35 bool SendMouseMove(long x, long y) { | 35 bool SendMouseMove(long x, long y) { |
36 // http://crbug.com/104396 | 36 gfx::Point point(x, y); |
37 NOTIMPLEMENTED(); | 37 aura::Desktop::GetInstance()->ConvertPointToNativeScreen(&point); |
38 return true; | 38 return internal::SendMouseMoveImpl(point.x(), point.y(), base::Closure()); |
39 } | 39 } |
40 | 40 |
41 bool SendMouseMoveNotifyWhenDone(long x, long y, const base::Closure& task) { | 41 bool SendMouseMoveNotifyWhenDone(long x, long y, const base::Closure& task) { |
42 // http://crbug.com/104396 | 42 gfx::Point point(x, y); |
43 NOTIMPLEMENTED(); | 43 aura::Desktop::GetInstance()->ConvertPointToNativeScreen(&point); |
44 return true; | 44 return internal::SendMouseMoveImpl(point.x(), point.y(), task); |
45 } | 45 } |
46 | 46 |
47 bool SendMouseEvents(MouseButton type, int state) { | 47 bool SendMouseEvents(MouseButton type, int state) { |
48 // http://crbug.com/104396 | 48 return internal::SendMouseEventsImpl(type, state, base::Closure()); |
49 NOTIMPLEMENTED(); | |
50 return true; | |
51 } | 49 } |
52 | 50 |
53 bool SendMouseEventsNotifyWhenDone(MouseButton type, int state, | 51 bool SendMouseEventsNotifyWhenDone(MouseButton type, int state, |
54 const base::Closure& task) { | 52 const base::Closure& task) { |
55 // http://crbug.com/104396 | 53 return internal::SendMouseEventsImpl(type, state, task); |
56 NOTIMPLEMENTED(); | |
57 return true; | |
58 } | 54 } |
59 | 55 |
60 bool SendMouseClick(MouseButton type) { | 56 bool SendMouseClick(MouseButton type) { |
61 return SendMouseEvents(type, UP | DOWN); | 57 return SendMouseEvents(type, UP | DOWN); |
62 } | 58 } |
63 | 59 |
64 void MoveMouseToCenterAndPress(views::View* view, MouseButton button, | 60 void MoveMouseToCenterAndPress(views::View* view, MouseButton button, |
sky
2011/11/22 00:28:33
nit: each param on its own line.
oshima
2011/11/22 01:36:10
Done.
| |
65 int state, const base::Closure& task) { | 61 int state, const base::Closure& task) { |
66 // http://crbug.com/104396 | 62 DCHECK(view); |
67 NOTIMPLEMENTED(); | 63 DCHECK(view->GetWidget()); |
64 gfx::Point view_center(view->width() / 2, view->height() / 2); | |
65 views::View::ConvertPointToScreen(view, &view_center); | |
66 SendMouseMove(view_center.x(), view_center.y()); | |
67 SendMouseEventsNotifyWhenDone(button, state, task); | |
68 } | 68 } |
69 | 69 |
70 } // namespace ui_controls | 70 } // namespace ui_controls |
OLD | NEW |