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

Side by Side Diff: ui/base/test/ui_controls_win.cc

Issue 851853002: It is time. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Trying to reup because the last upload failed. Created 5 years, 11 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
« no previous file with comments | « ui/base/test/ui_controls_mac.mm ('k') | ui/base/theme_provider.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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 "ui/base/test/ui_controls.h"
6
7 #include "base/callback.h"
8 #include "base/message_loop/message_loop.h"
9 #include "ui/base/test/ui_controls_internal_win.h"
10 #include "ui/gfx/point.h"
11
12 namespace ui_controls {
13 bool g_ui_controls_enabled = false;
14
15 void EnableUIControls() {
16 g_ui_controls_enabled = true;
17 }
18
19 bool SendKeyPress(gfx::NativeWindow window,
20 ui::KeyboardCode key,
21 bool control,
22 bool shift,
23 bool alt,
24 bool command) {
25 CHECK(g_ui_controls_enabled);
26 DCHECK(!command); // No command key on Windows
27 return internal::SendKeyPressImpl(window, key, control, shift, alt,
28 base::Closure());
29 }
30
31 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
32 ui::KeyboardCode key,
33 bool control,
34 bool shift,
35 bool alt,
36 bool command,
37 const base::Closure& task) {
38 CHECK(g_ui_controls_enabled);
39 DCHECK(!command); // No command key on Windows
40 return internal::SendKeyPressImpl(window, key, control, shift, alt, task);
41 }
42
43 bool SendMouseMove(long x, long y) {
44 CHECK(g_ui_controls_enabled);
45 return internal::SendMouseMoveImpl(x, y, base::Closure());
46 }
47
48 bool SendMouseMoveNotifyWhenDone(long x, long y, const base::Closure& task) {
49 CHECK(g_ui_controls_enabled);
50 return internal::SendMouseMoveImpl(x, y, task);
51 }
52
53 bool SendMouseEvents(MouseButton type, int state) {
54 CHECK(g_ui_controls_enabled);
55 return internal::SendMouseEventsImpl(type, state, base::Closure());
56 }
57
58 bool SendMouseEventsNotifyWhenDone(MouseButton type, int state,
59 const base::Closure& task) {
60 CHECK(g_ui_controls_enabled);
61 return internal::SendMouseEventsImpl(type, state, task);
62 }
63
64 bool SendMouseClick(MouseButton type) {
65 CHECK(g_ui_controls_enabled);
66 return internal::SendMouseEventsImpl(type, UP | DOWN, base::Closure());
67 }
68
69 void RunClosureAfterAllPendingUIEvents(const base::Closure& closure) {
70 // On windows, posting UI events is synchronous so just post the closure.
71 base::MessageLoopForUI::current()->PostTask(FROM_HERE, closure);
72 }
73
74 } // namespace ui_controls
OLDNEW
« no previous file with comments | « ui/base/test/ui_controls_mac.mm ('k') | ui/base/theme_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698