OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #import <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "webkit/plugins/npapi/plugin_web_event_converter_mac.h" | 8 #include "content/child/npapi/plugin_web_event_converter_mac.h" |
9 #include "third_party/WebKit/public/web/WebInputEvent.h" | 9 #include "third_party/WebKit/public/web/WebInputEvent.h" |
10 | 10 |
11 using WebKit::WebInputEvent; | 11 using WebKit::WebInputEvent; |
12 using WebKit::WebKeyboardEvent; | 12 using WebKit::WebKeyboardEvent; |
13 using WebKit::WebMouseEvent; | 13 using WebKit::WebMouseEvent; |
14 using WebKit::WebMouseWheelEvent; | 14 using WebKit::WebMouseWheelEvent; |
15 | 15 |
16 namespace webkit { | 16 namespace content { |
17 namespace npapi { | |
18 | 17 |
19 namespace { | 18 namespace { |
20 | 19 |
21 // Returns true if the given key is a modifier key. | 20 // Returns true if the given key is a modifier key. |
22 bool KeyIsModifier(int native_key_code) { | 21 bool KeyIsModifier(int native_key_code) { |
23 switch (native_key_code) { | 22 switch (native_key_code) { |
24 case 55: // Left command | 23 case 55: // Left command |
25 case 54: // Right command | 24 case 54: // Right command |
26 case 58: // Left option | 25 case 58: // Left option |
27 case 61: // Right option | 26 case 61: // Right option |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 modifiers |= NSShiftKeyMask; | 178 modifiers |= NSShiftKeyMask; |
180 if (web_event.modifiers & WebInputEvent::AltKey) | 179 if (web_event.modifiers & WebInputEvent::AltKey) |
181 modifiers |= NSAlternateKeyMask; | 180 modifiers |= NSAlternateKeyMask; |
182 if (web_event.modifiers & WebInputEvent::MetaKey) | 181 if (web_event.modifiers & WebInputEvent::MetaKey) |
183 modifiers |= NSCommandKeyMask; | 182 modifiers |= NSCommandKeyMask; |
184 if (CapsLockIsActive(web_event)) | 183 if (CapsLockIsActive(web_event)) |
185 modifiers |= NSAlphaShiftKeyMask; | 184 modifiers |= NSAlphaShiftKeyMask; |
186 return modifiers; | 185 return modifiers; |
187 } | 186 } |
188 | 187 |
189 } // namespace npapi | 188 } // namespace content |
190 } // namespace webkit | |
OLD | NEW |