Change layout of app list items in experimental app list.
[chromium-blink-merge.git] / ui / aura / test / ui_controls_factory_aurawin.cc
blob717aea5ee607d7fa8a640a373ab5ac5e92af7e10
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 "base/basictypes.h"
6 #include "base/logging.h"
7 #include "base/message_loop/message_loop.h"
8 #include "ui/aura/test/ui_controls_factory_aura.h"
9 #include "ui/aura/window.h"
10 #include "ui/aura/window_tree_host.h"
11 #include "ui/base/test/ui_controls_aura.h"
12 #include "ui/base/test/ui_controls_internal_win.h"
14 namespace aura {
15 namespace test {
17 namespace {
19 using ui_controls::DOWN;
20 using ui_controls::LEFT;
21 using ui_controls::MIDDLE;
22 using ui_controls::MouseButton;
23 using ui_controls::RIGHT;
24 using ui_controls::UIControlsAura;
25 using ui_controls::UP;
26 using namespace ui_controls::internal;
28 class UIControlsWin : public UIControlsAura {
29 public:
30 UIControlsWin() {}
32 // UIControlsAura overrides:
33 virtual bool SendKeyPress(gfx::NativeWindow native_window,
34 ui::KeyboardCode key,
35 bool control,
36 bool shift,
37 bool alt,
38 bool command) {
39 DCHECK(!command); // No command key on Aura
40 HWND window =
41 native_window->GetHost()->GetAcceleratedWidget();
42 return SendKeyPressImpl(
43 window, key, control, shift, alt, base::Closure());
45 virtual bool SendKeyPressNotifyWhenDone(gfx::NativeWindow native_window,
46 ui::KeyboardCode key,
47 bool control,
48 bool shift,
49 bool alt,
50 bool command,
51 const base::Closure& task) {
52 DCHECK(!command); // No command key on Aura
53 HWND window =
54 native_window->GetHost()->GetAcceleratedWidget();
55 return SendKeyPressImpl(window, key, control, shift, alt, task);
57 virtual bool SendMouseMove(long screen_x, long screen_y) {
58 return SendMouseMoveImpl(screen_x, screen_y, base::Closure());
60 virtual bool SendMouseMoveNotifyWhenDone(long screen_x,
61 long screen_y,
62 const base::Closure& task) {
63 return SendMouseMoveImpl(screen_x, screen_y, task);
65 virtual bool SendMouseEvents(MouseButton type, int state) {
66 return SendMouseEventsImpl(type, state, base::Closure());
68 virtual bool SendMouseEventsNotifyWhenDone(MouseButton type,
69 int state,
70 const base::Closure& task) {
71 return SendMouseEventsImpl(type, state, task);
73 virtual bool SendMouseClick(MouseButton type) {
74 return SendMouseEvents(type, UP | DOWN);
76 virtual void RunClosureAfterAllPendingUIEvents(const base::Closure& closure) {
77 // On windows, posting UI events is synchronous so just post the closure.
78 base::MessageLoopForUI::current()->PostTask(FROM_HERE, closure);
81 private:
82 DISALLOW_COPY_AND_ASSIGN(UIControlsWin);
85 } // namespace
87 UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) {
88 return new UIControlsWin();
91 } // namespace test
92 } // namespace aura