OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/logging.h" | 6 #include "base/logging.h" |
7 #include "ui/aura/client/screen_position_client.h" | 7 #include "ui/aura/client/screen_position_client.h" |
8 #include "ui/aura/env.h" | 8 #include "ui/aura/env.h" |
9 #include "ui/aura/test/aura_test_utils.h" | 9 #include "ui/aura/test/aura_test_utils.h" |
10 #include "ui/aura/test/ui_controls_factory_aura.h" | 10 #include "ui/aura/test/ui_controls_factory_aura.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 window, key, control, shift, alt, command, base::Closure()); | 29 window, key, control, shift, alt, command, base::Closure()); |
30 } | 30 } |
31 virtual bool SendKeyPressNotifyWhenDone( | 31 virtual bool SendKeyPressNotifyWhenDone( |
32 gfx::NativeWindow window, | 32 gfx::NativeWindow window, |
33 ui::KeyboardCode key, | 33 ui::KeyboardCode key, |
34 bool control, | 34 bool control, |
35 bool shift, | 35 bool shift, |
36 bool alt, | 36 bool alt, |
37 bool command, | 37 bool command, |
38 const base::Closure& closure) OVERRIDE { | 38 const base::Closure& closure) OVERRIDE { |
| 39 DCHECK(!command); // No command key on Aura |
| 40 |
39 int flags = button_down_mask_; | 41 int flags = button_down_mask_; |
40 | 42 |
41 if (control) { | 43 if (control) { |
42 flags |= ui::EF_CONTROL_DOWN; | 44 flags |= ui::EF_CONTROL_DOWN; |
43 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_CONTROL, flags); | 45 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_CONTROL, flags); |
44 } | 46 } |
45 | 47 |
46 if (shift) { | 48 if (shift) { |
47 flags |= ui::EF_SHIFT_DOWN; | 49 flags |= ui::EF_SHIFT_DOWN; |
48 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_SHIFT, flags); | 50 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_SHIFT, flags); |
49 } | 51 } |
50 | 52 |
51 if (alt) { | 53 if (alt) { |
52 flags |= ui::EF_ALT_DOWN; | 54 flags |= ui::EF_ALT_DOWN; |
53 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_MENU, flags); | 55 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_MENU, flags); |
54 } | 56 } |
55 | 57 |
56 if (command) { | |
57 flags |= ui::EF_COMMAND_DOWN; | |
58 PostKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_LWIN, flags); | |
59 } | |
60 | |
61 PostKeyEvent(ui::ET_KEY_PRESSED, key, flags); | 58 PostKeyEvent(ui::ET_KEY_PRESSED, key, flags); |
62 PostKeyEvent(ui::ET_KEY_RELEASED, key, flags); | 59 PostKeyEvent(ui::ET_KEY_RELEASED, key, flags); |
63 | 60 |
64 if (alt) { | 61 if (alt) { |
65 flags &= ~ui::EF_ALT_DOWN; | 62 flags &= ~ui::EF_ALT_DOWN; |
66 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_MENU, flags); | 63 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_MENU, flags); |
67 } | 64 } |
68 | 65 |
69 if (shift) { | 66 if (shift) { |
70 flags &= ~ui::EF_SHIFT_DOWN; | 67 flags &= ~ui::EF_SHIFT_DOWN; |
71 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_SHIFT, flags); | 68 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_SHIFT, flags); |
72 } | 69 } |
73 | 70 |
74 if (control) { | 71 if (control) { |
75 flags &= ~ui::EF_CONTROL_DOWN; | 72 flags &= ~ui::EF_CONTROL_DOWN; |
76 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_CONTROL, flags); | 73 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_CONTROL, flags); |
77 } | 74 } |
78 | 75 |
79 if (command) { | |
80 flags &= ~ui::EF_COMMAND_DOWN; | |
81 PostKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_LWIN, flags); | |
82 } | |
83 | |
84 RunClosureAfterAllPendingUIEvents(closure); | 76 RunClosureAfterAllPendingUIEvents(closure); |
85 return true; | 77 return true; |
86 } | 78 } |
87 | 79 |
88 virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { | 80 virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { |
89 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); | 81 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); |
90 } | 82 } |
91 virtual bool SendMouseMoveNotifyWhenDone( | 83 virtual bool SendMouseMoveNotifyWhenDone( |
92 long screen_x, | 84 long screen_x, |
93 long screen_y, | 85 long screen_y, |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 }; | 213 }; |
222 | 214 |
223 } // namespace | 215 } // namespace |
224 | 216 |
225 ui_controls::UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { | 217 ui_controls::UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { |
226 return new UIControlsOzone(host); | 218 return new UIControlsOzone(host); |
227 } | 219 } |
228 | 220 |
229 } // namespace test | 221 } // namespace test |
230 } // namespace aura | 222 } // namespace aura |
OLD | NEW |