Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(139)

Side by Side Diff: ui/aura/test/ui_controls_factory_aurax11.cc

Issue 576413002: Reland Track the active ExtensionKeybindingRegistry and make it available to EventRewriter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/keybinding/chromeos_conversions/manifest.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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 <X11/keysym.h> 5 #include <X11/keysym.h>
6 #include <X11/Xlib.h> 6 #include <X11/Xlib.h>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/aura/client/screen_position_client.h" 10 #include "ui/aura/client/screen_position_client.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 public: 49 public:
50 UIControlsX11(WindowTreeHost* host) : host_(host) { 50 UIControlsX11(WindowTreeHost* host) : host_(host) {
51 } 51 }
52 52
53 virtual bool SendKeyPress(gfx::NativeWindow window, 53 virtual bool SendKeyPress(gfx::NativeWindow window,
54 ui::KeyboardCode key, 54 ui::KeyboardCode key,
55 bool control, 55 bool control,
56 bool shift, 56 bool shift,
57 bool alt, 57 bool alt,
58 bool command) OVERRIDE { 58 bool command) OVERRIDE {
59 DCHECK(!command); // No command key on Aura
60 return SendKeyPressNotifyWhenDone( 59 return SendKeyPressNotifyWhenDone(
61 window, key, control, shift, alt, command, base::Closure()); 60 window, key, control, shift, alt, command, base::Closure());
62 } 61 }
63 virtual bool SendKeyPressNotifyWhenDone( 62 virtual bool SendKeyPressNotifyWhenDone(
64 gfx::NativeWindow window, 63 gfx::NativeWindow window,
65 ui::KeyboardCode key, 64 ui::KeyboardCode key,
66 bool control, 65 bool control,
67 bool shift, 66 bool shift,
68 bool alt, 67 bool alt,
69 bool command, 68 bool command,
70 const base::Closure& closure) OVERRIDE { 69 const base::Closure& closure) OVERRIDE {
71 DCHECK(!command); // No command key on Aura
72 XEvent xevent = {0}; 70 XEvent xevent = {0};
73 xevent.xkey.type = KeyPress; 71 xevent.xkey.type = KeyPress;
74 if (control) 72 if (control)
75 SetKeycodeAndSendThenMask(&xevent, XK_Control_L, ControlMask); 73 SetKeycodeAndSendThenMask(&xevent, XK_Control_L, ControlMask);
76 if (shift) 74 if (shift)
77 SetKeycodeAndSendThenMask(&xevent, XK_Shift_L, ShiftMask); 75 SetKeycodeAndSendThenMask(&xevent, XK_Shift_L, ShiftMask);
78 if (alt) 76 if (alt)
79 SetKeycodeAndSendThenMask(&xevent, XK_Alt_L, Mod1Mask); 77 SetKeycodeAndSendThenMask(&xevent, XK_Alt_L, Mod1Mask);
78 if (command)
79 SetKeycodeAndSendThenMask(&xevent, XK_Meta_L, Mod4Mask);
80 xevent.xkey.keycode = 80 xevent.xkey.keycode =
81 XKeysymToKeycode(gfx::GetXDisplay(), 81 XKeysymToKeycode(gfx::GetXDisplay(),
82 ui::XKeysymForWindowsKeyCode(key, shift)); 82 ui::XKeysymForWindowsKeyCode(key, shift));
83 host_->PostNativeEvent(&xevent); 83 host_->PostNativeEvent(&xevent);
84 84
85 // Send key release events. 85 // Send key release events.
86 xevent.xkey.type = KeyRelease; 86 xevent.xkey.type = KeyRelease;
87 host_->PostNativeEvent(&xevent); 87 host_->PostNativeEvent(&xevent);
88 if (alt) 88 if (alt)
89 UnmaskAndSetKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L); 89 UnmaskAndSetKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L);
90 if (shift) 90 if (shift)
91 UnmaskAndSetKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); 91 UnmaskAndSetKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L);
92 if (control) 92 if (control)
93 UnmaskAndSetKeycodeThenSend(&xevent, ControlMask, XK_Control_L); 93 UnmaskAndSetKeycodeThenSend(&xevent, ControlMask, XK_Control_L);
94 if (command)
95 UnmaskAndSetKeycodeThenSend(&xevent, Mod4Mask, XK_Meta_L);
94 DCHECK(!xevent.xkey.state); 96 DCHECK(!xevent.xkey.state);
95 RunClosureAfterAllPendingUIEvents(closure); 97 RunClosureAfterAllPendingUIEvents(closure);
96 return true; 98 return true;
97 } 99 }
98 100
99 virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { 101 virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE {
100 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); 102 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure());
101 } 103 }
102 virtual bool SendMouseMoveNotifyWhenDone( 104 virtual bool SendMouseMoveNotifyWhenDone(
103 long screen_x, 105 long screen_x,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 }; 225 };
224 226
225 } // namespace 227 } // namespace
226 228
227 UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { 229 UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) {
228 return new UIControlsX11(host); 230 return new UIControlsX11(host);
229 } 231 }
230 232
231 } // namespace test 233 } // namespace test
232 } // namespace aura 234 } // namespace aura
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/keybinding/chromeos_conversions/manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698