Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / base / test / ui_controls_aura.cc
blobc8367ab803997d1303a8d92c110686a180e1b538
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.
5 #include "ui/base/test/ui_controls_aura.h"
7 #include "base/logging.h"
9 namespace ui_controls {
10 namespace {
11 UIControlsAura* instance_ = NULL;
12 bool g_ui_controls_enabled = false;
13 } // namespace
15 void EnableUIControls() {
16 g_ui_controls_enabled = true;
19 // An interface to provide Aura implementation of UI control.
20 bool SendKeyPress(gfx::NativeWindow window,
21 ui::KeyboardCode key,
22 bool control,
23 bool shift,
24 bool alt,
25 bool command) {
26 CHECK(g_ui_controls_enabled);
27 return instance_->SendKeyPress(
28 window, key, control, shift, alt, command);
31 // static
32 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
33 ui::KeyboardCode key,
34 bool control,
35 bool shift,
36 bool alt,
37 bool command,
38 const base::Closure& task) {
39 CHECK(g_ui_controls_enabled);
40 return instance_->SendKeyPressNotifyWhenDone(
41 window, key, control, shift, alt, command, task);
44 // static
45 bool SendMouseMove(long x, long y) {
46 CHECK(g_ui_controls_enabled);
47 return instance_->SendMouseMove(x, y);
50 // static
51 bool SendMouseMoveNotifyWhenDone(long x,
52 long y,
53 const base::Closure& task) {
54 CHECK(g_ui_controls_enabled);
55 return instance_->SendMouseMoveNotifyWhenDone(x, y, task);
58 // static
59 bool SendMouseEvents(MouseButton type, int state) {
60 CHECK(g_ui_controls_enabled);
61 return instance_->SendMouseEvents(type, state);
64 // static
65 bool SendMouseEventsNotifyWhenDone(MouseButton type,
66 int state,
67 const base::Closure& task) {
68 CHECK(g_ui_controls_enabled);
69 return instance_->SendMouseEventsNotifyWhenDone(type, state, task);
72 // static
73 bool SendMouseClick(MouseButton type) {
74 CHECK(g_ui_controls_enabled);
75 return instance_->SendMouseClick(type);
78 // static
79 void RunClosureAfterAllPendingUIEvents(const base::Closure& closure) {
80 instance_->RunClosureAfterAllPendingUIEvents(closure);
83 UIControlsAura::UIControlsAura() {
86 UIControlsAura::~UIControlsAura() {
89 // static. declared in ui_controls.h
90 void InstallUIControlsAura(UIControlsAura* instance) {
91 delete instance_;
92 instance_ = instance;
95 } // namespace ui_controls