This source file includes following definitions.
- SendKeyPress
- SendKeyPressNotifyWhenDone
- SendMouseMove
- SendMouseMoveNotifyWhenDone
- SendMouseEvents
- SendMouseEventsNotifyWhenDone
- SendMouseClick
- RunClosureAfterAllPendingUIEvents
- CreateUIControlsAura
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/message_loop/message_loop.h"
#include "ui/aura/test/ui_controls_factory_aura.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/test/ui_controls_aura.h"
#include "ui/base/test/ui_controls_internal_win.h"
namespace aura {
namespace test {
namespace {
using ui_controls::DOWN;
using ui_controls::LEFT;
using ui_controls::MIDDLE;
using ui_controls::MouseButton;
using ui_controls::RIGHT;
using ui_controls::UIControlsAura;
using ui_controls::UP;
using namespace ui_controls::internal;
class UIControlsWin : public UIControlsAura {
public:
UIControlsWin() {}
virtual bool SendKeyPress(gfx::NativeWindow native_window,
ui::KeyboardCode key,
bool control,
bool shift,
bool alt,
bool command) {
DCHECK(!command);
HWND window =
native_window->GetHost()->GetAcceleratedWidget();
return SendKeyPressImpl(
window, key, control, shift, alt, base::Closure());
}
virtual bool SendKeyPressNotifyWhenDone(gfx::NativeWindow native_window,
ui::KeyboardCode key,
bool control,
bool shift,
bool alt,
bool command,
const base::Closure& task) {
DCHECK(!command);
HWND window =
native_window->GetHost()->GetAcceleratedWidget();
return SendKeyPressImpl(window, key, control, shift, alt, task);
}
virtual bool SendMouseMove(long screen_x, long screen_y) {
return SendMouseMoveImpl(screen_x, screen_y, base::Closure());
}
virtual bool SendMouseMoveNotifyWhenDone(long screen_x,
long screen_y,
const base::Closure& task) {
return SendMouseMoveImpl(screen_x, screen_y, task);
}
virtual bool SendMouseEvents(MouseButton type, int state) {
return SendMouseEventsImpl(type, state, base::Closure());
}
virtual bool SendMouseEventsNotifyWhenDone(MouseButton type,
int state,
const base::Closure& task) {
return SendMouseEventsImpl(type, state, task);
}
virtual bool SendMouseClick(MouseButton type) {
return SendMouseEvents(type, UP | DOWN);
}
virtual void RunClosureAfterAllPendingUIEvents(const base::Closure& closure) {
base::MessageLoopForUI::current()->PostTask(FROM_HERE, closure);
}
private:
DISALLOW_COPY_AND_ASSIGN(UIControlsWin);
};
}
UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) {
return new UIControlsWin();
}
}
}