| OLD | NEW |
| (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_aura.h" | |
| 6 | |
| 7 #include "base/logging.h" | |
| 8 | |
| 9 namespace ui_controls { | |
| 10 namespace { | |
| 11 UIControlsAura* instance_ = NULL; | |
| 12 bool g_ui_controls_enabled = false; | |
| 13 } // namespace | |
| 14 | |
| 15 void EnableUIControls() { | |
| 16 g_ui_controls_enabled = true; | |
| 17 } | |
| 18 | |
| 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); | |
| 29 } | |
| 30 | |
| 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); | |
| 42 } | |
| 43 | |
| 44 // static | |
| 45 bool SendMouseMove(long x, long y) { | |
| 46 CHECK(g_ui_controls_enabled); | |
| 47 return instance_->SendMouseMove(x, y); | |
| 48 } | |
| 49 | |
| 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); | |
| 56 } | |
| 57 | |
| 58 // static | |
| 59 bool SendMouseEvents(MouseButton type, int state) { | |
| 60 CHECK(g_ui_controls_enabled); | |
| 61 return instance_->SendMouseEvents(type, state); | |
| 62 } | |
| 63 | |
| 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); | |
| 70 } | |
| 71 | |
| 72 // static | |
| 73 bool SendMouseClick(MouseButton type) { | |
| 74 CHECK(g_ui_controls_enabled); | |
| 75 return instance_->SendMouseClick(type); | |
| 76 } | |
| 77 | |
| 78 // static | |
| 79 void RunClosureAfterAllPendingUIEvents(const base::Closure& closure) { | |
| 80 instance_->RunClosureAfterAllPendingUIEvents(closure); | |
| 81 } | |
| 82 | |
| 83 UIControlsAura::UIControlsAura() { | |
| 84 } | |
| 85 | |
| 86 UIControlsAura::~UIControlsAura() { | |
| 87 } | |
| 88 | |
| 89 // static. declared in ui_controls.h | |
| 90 void InstallUIControlsAura(UIControlsAura* instance) { | |
| 91 delete instance_; | |
| 92 instance_ = instance; | |
| 93 } | |
| 94 | |
| 95 } // namespace ui_controls | |
| OLD | NEW |