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

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

Issue 8585015: Implement ui_controls for aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no mask for xsendevent Created 9 years, 1 month 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) 2011 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/logging.h"
8 #include "chrome/browser/automation/ui_controls_internal.h"
9 #include "ui/aura/desktop.h"
10 #include "views/view.h"
11
12 namespace ui_controls {
13
14 bool SendKeyPress(gfx::NativeWindow window,
15 ui::KeyboardCode key,
16 bool control,
17 bool shift,
18 bool alt,
19 bool command) {
20 DCHECK(!command); // No command key on Aura
21 return internal::SendKeyPressImpl(key, control, shift, alt, base::Closure());
22 }
23
24 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
25 ui::KeyboardCode key,
26 bool control,
27 bool shift,
28 bool alt,
29 bool command,
30 const base::Closure& task) {
31 DCHECK(!command); // No command key on Aura
32 return internal::SendKeyPressImpl(key, control, shift, alt, task);
33 }
34
35 bool SendMouseMove(long x, long y) {
36 gfx::Point point(x, y);
37 aura::Desktop::GetInstance()->ConvertPointToNativeScreen(&point);
38 return internal::SendMouseMoveImpl(point.x(), point.y(), base::Closure());
39 }
40
41 bool SendMouseMoveNotifyWhenDone(long x, long y, const base::Closure& task) {
42 gfx::Point point(x, y);
43 aura::Desktop::GetInstance()->ConvertPointToNativeScreen(&point);
44 return internal::SendMouseMoveImpl(point.x(), point.y(), task);
45 }
46
47 bool SendMouseEvents(MouseButton type, int state) {
48 return internal::SendMouseEventsImpl(type, state, base::Closure());
49 }
50
51 bool SendMouseEventsNotifyWhenDone(MouseButton type, int state,
52 const base::Closure& task) {
53 return internal::SendMouseEventsImpl(type, state, task);
54 }
55
56 bool SendMouseClick(MouseButton type) {
57 return SendMouseEvents(type, UP | DOWN);
58 }
59
60 void MoveMouseToCenterAndPress(views::View* view,
61 MouseButton button,
62 int state,
63 const base::Closure& task) {
64 DCHECK(view);
65 DCHECK(view->GetWidget());
66 gfx::Point view_center(view->width() / 2, view->height() / 2);
67 views::View::ConvertPointToScreen(view, &view_center);
68 SendMouseMove(view_center.x(), view_center.y());
69 SendMouseEventsNotifyWhenDone(button, state, task);
70 }
71
72 } // namespace ui_controls
OLDNEW
« no previous file with comments | « chrome/browser/automation/ui_controls_aura.cc ('k') | chrome/browser/automation/ui_controls_aurax11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698