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

Side by Side Diff: chrome/browser/automation/ui_controls_win.cc

Issue 9390038: Move automation/ui_controls to ui/ui_controls (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win_aura fix, sync Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/automation/ui_controls.h"
6
7 #include "base/callback.h"
8 #include "base/message_loop.h"
9 #include "chrome/browser/automation/ui_controls_internal.h"
10 #include "ui/gfx/point.h"
11 #include "ui/views/view.h"
12
13 namespace ui_controls {
14
15 bool SendKeyPress(gfx::NativeWindow window,
16 ui::KeyboardCode key,
17 bool control,
18 bool shift,
19 bool alt,
20 bool command) {
21 DCHECK(!command); // No command key on Windows
22 return internal::SendKeyPressImpl(window, key, control, shift, alt,
23 base::Closure());
24 }
25
26 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
27 ui::KeyboardCode key,
28 bool control,
29 bool shift,
30 bool alt,
31 bool command,
32 const base::Closure& task) {
33 DCHECK(!command); // No command key on Windows
34 return internal::SendKeyPressImpl(window, key, control, shift, alt, task);
35 }
36
37 bool SendMouseMove(long x, long y) {
38 return internal::SendMouseMoveImpl(x, y, base::Closure());
39 }
40
41 bool SendMouseMoveNotifyWhenDone(long x, long y, const base::Closure& task) {
42 return internal::SendMouseMoveImpl(x, y, task);
43 }
44
45 bool SendMouseEvents(MouseButton type, int state) {
46 return internal::SendMouseEventsImpl(type, state, base::Closure());
47 }
48
49 bool SendMouseEventsNotifyWhenDone(MouseButton type, int state,
50 const base::Closure& task) {
51 return internal::SendMouseEventsImpl(type, state, task);
52 }
53
54 bool SendMouseClick(MouseButton type) {
55 return internal::SendMouseEventsImpl(type, UP | DOWN, base::Closure());
56 }
57
58 void MoveMouseToCenterAndPress(views::View* view,
59 MouseButton button,
60 int state,
61 const base::Closure& task) {
62 DCHECK(view);
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 }
69
70 void RunClosureAfterAllPendingUIEvents(const base::Closure& closure) {
71 // On windows, posting UI events is synchronous so just post the closure.
72 MessageLoopForUI::current()->PostTask(FROM_HERE, closure);
73 }
74
75 } // ui_controls
OLDNEW
« no previous file with comments | « chrome/browser/automation/ui_controls_mac.mm ('k') | chrome/browser/chromeos/login/screen_locker_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698