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" |
212 cocoa_event_.data.key.characters = reinterpret_cast<NPNSString*>( | 215 cocoa_event_.data.key.characters = reinterpret_cast<NPNSString*>( |
213 [NSString stringWithFormat:@"%S", key_event.text]); | 216 [NSString stringWithFormat:@"%S", key_event.text]); |
214 cocoa_event_.data.key.charactersIgnoringModifiers = | 217 cocoa_event_.data.key.charactersIgnoringModifiers = |
215 reinterpret_cast<NPNSString*>( | 218 reinterpret_cast<NPNSString*>( |
216 [NSString stringWithFormat:@"%S", key_event.unmodifiedText]); | 219 [NSString stringWithFormat:@"%S", key_event.unmodifiedText]); |
| 220 #pragma clang diagnostic pop |
217 | 221 |
218 if (key_event.modifiers & WebInputEvent::IsAutoRepeat) | 222 if (key_event.modifiers & WebInputEvent::IsAutoRepeat) |
219 cocoa_event_.data.key.isARepeat = true; | 223 cocoa_event_.data.key.isARepeat = true; |
220 | 224 |
221 switch (key_event.type) { | 225 switch (key_event.type) { |
222 case WebInputEvent::KeyDown: | 226 case WebInputEvent::KeyDown: |
223 cocoa_event_.type = NPCocoaEventKeyDown; | 227 cocoa_event_.type = NPCocoaEventKeyDown; |
224 return true; | 228 return true; |
225 case WebInputEvent::KeyUp: | 229 case WebInputEvent::KeyUp: |
226 cocoa_event_.type = NPCocoaEventKeyUp; | 230 cocoa_event_.type = NPCocoaEventKeyUp; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 return new CarbonPluginWebEventConverter(); | 360 return new CarbonPluginWebEventConverter(); |
357 #endif | 361 #endif |
358 default: | 362 default: |
359 NOTIMPLEMENTED(); | 363 NOTIMPLEMENTED(); |
360 return NULL; | 364 return NULL; |
361 } | 365 } |
362 } | 366 } |
363 | 367 |
364 } // namespace npapi | 368 } // namespace npapi |
365 } // namespace webkit | 369 } // namespace webkit |
OLD | NEW |