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 "webkit/plugins/npapi/plugin_web_event_converter_mac.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
10 | 10 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 cocoa_event_.data.key.modifierFlags |= CocoaModifiers(key_event); | 203 cocoa_event_.data.key.modifierFlags |= CocoaModifiers(key_event); |
204 | 204 |
205 // Modifier keys have their own event type, and don't get character or | 205 // Modifier keys have their own event type, and don't get character or |
206 // repeat data. | 206 // repeat data. |
207 if (KeyIsModifier(key_event.nativeKeyCode)) { | 207 if (KeyIsModifier(key_event.nativeKeyCode)) { |
208 cocoa_event_.type = NPCocoaEventFlagsChanged; | 208 cocoa_event_.type = NPCocoaEventFlagsChanged; |
209 return true; | 209 return true; |
210 } | 210 } |
211 | 211 |
212 // TODO(thakis): Remove this once clang is smarter, http://crbug.com/111861 | |
213 #pragma clang diagnostic push | |
214 #pragma clang diagnostic ignored "-Wformat" | |
215 cocoa_event_.data.key.characters = reinterpret_cast<NPNSString*>( | 212 cocoa_event_.data.key.characters = reinterpret_cast<NPNSString*>( |
216 [NSString stringWithFormat:@"%S", key_event.text]); | 213 [NSString stringWithFormat:@"%S", key_event.text]); |
217 cocoa_event_.data.key.charactersIgnoringModifiers = | 214 cocoa_event_.data.key.charactersIgnoringModifiers = |
218 reinterpret_cast<NPNSString*>( | 215 reinterpret_cast<NPNSString*>( |
219 [NSString stringWithFormat:@"%S", key_event.unmodifiedText]); | 216 [NSString stringWithFormat:@"%S", key_event.unmodifiedText]); |
220 #pragma clang diagnostic pop | |
221 | 217 |
222 if (key_event.modifiers & WebInputEvent::IsAutoRepeat) | 218 if (key_event.modifiers & WebInputEvent::IsAutoRepeat) |
223 cocoa_event_.data.key.isARepeat = true; | 219 cocoa_event_.data.key.isARepeat = true; |
224 | 220 |
225 switch (key_event.type) { | 221 switch (key_event.type) { |
226 case WebInputEvent::KeyDown: | 222 case WebInputEvent::KeyDown: |
227 cocoa_event_.type = NPCocoaEventKeyDown; | 223 cocoa_event_.type = NPCocoaEventKeyDown; |
228 return true; | 224 return true; |
229 case WebInputEvent::KeyUp: | 225 case WebInputEvent::KeyUp: |
230 cocoa_event_.type = NPCocoaEventKeyUp; | 226 cocoa_event_.type = NPCocoaEventKeyUp; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 return new CarbonPluginWebEventConverter(); | 356 return new CarbonPluginWebEventConverter(); |
361 #endif | 357 #endif |
362 default: | 358 default: |
363 NOTIMPLEMENTED(); | 359 NOTIMPLEMENTED(); |
364 return NULL; | 360 return NULL; |
365 } | 361 } |
366 } | 362 } |
367 | 363 |
368 } // namespace npapi | 364 } // namespace npapi |
369 } // namespace webkit | 365 } // namespace webkit |
OLD | NEW |