OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #import <QuartzCore/QuartzCore.h> | 6 #import <QuartzCore/QuartzCore.h> |
7 | 7 |
8 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 8 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 #endif | 613 #endif |
614 | 614 |
615 // Send the plugin the event. | 615 // Send the plugin the event. |
616 scoped_ptr<NPAPI::ScopedCurrentPluginEvent> event_scope(NULL); | 616 scoped_ptr<NPAPI::ScopedCurrentPluginEvent> event_scope(NULL); |
617 if (instance()->event_model() == NPEventModelCocoa) { | 617 if (instance()->event_model() == NPEventModelCocoa) { |
618 event_scope.reset(new NPAPI::ScopedCurrentPluginEvent( | 618 event_scope.reset(new NPAPI::ScopedCurrentPluginEvent( |
619 instance(), static_cast<NPCocoaEvent*>(plugin_event))); | 619 instance(), static_cast<NPCocoaEvent*>(plugin_event))); |
620 } | 620 } |
621 bool handled = instance()->NPP_HandleEvent(plugin_event) != 0; | 621 bool handled = instance()->NPP_HandleEvent(plugin_event) != 0; |
622 | 622 |
| 623 // Plugins don't give accurate information about whether or not they handled |
| 624 // events, so browsers on the Mac ignore the return value. |
| 625 // Scroll events are the exception, since the Cocoa spec defines a meaning |
| 626 // for the return value. |
623 if (WebInputEvent::isMouseEventType(event.type)) { | 627 if (WebInputEvent::isMouseEventType(event.type)) { |
624 // Plugins are not good about giving accurate information about whether or | |
625 // not they handled events, and other browsers on the Mac generally ignore | |
626 // the return value. We may need to expand this to other input types, but | |
627 // we'll need to be careful about things like Command-keys. | |
628 handled = true; | 628 handled = true; |
| 629 } else if (WebInputEvent::isKeyboardEventType(event.type)) { |
| 630 // For Command-key events, trust the return value since eating all menu |
| 631 // shortcuts is not ideal. |
| 632 // TODO(stuartmorgan): Implement the advanced key handling spec, and trust |
| 633 // trust the key event return value from plugins that implement it. |
| 634 if (!(event.modifiers & WebInputEvent::MetaKey)) |
| 635 handled = true; |
629 } | 636 } |
630 | 637 |
631 return handled; | 638 return handled; |
632 } | 639 } |
633 | 640 |
634 void WebPluginDelegateImpl::InstallMissingPlugin() { | 641 void WebPluginDelegateImpl::InstallMissingPlugin() { |
635 NOTIMPLEMENTED(); | 642 NOTIMPLEMENTED(); |
636 } | 643 } |
637 | 644 |
638 #pragma mark - | 645 #pragma mark - |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1144 return; | 1151 return; |
1145 } | 1152 } |
1146 | 1153 |
1147 qd_manager_->SetFastPathEnabled(enabled); | 1154 qd_manager_->SetFastPathEnabled(enabled); |
1148 qd_port_.port = qd_manager_->port(); | 1155 qd_port_.port = qd_manager_->port(); |
1149 WindowlessSetWindow(); | 1156 WindowlessSetWindow(); |
1150 // Send a paint event so that the new buffer gets updated immediately. | 1157 // Send a paint event so that the new buffer gets updated immediately. |
1151 WindowlessPaint(buffer_context_, clip_rect_); | 1158 WindowlessPaint(buffer_context_, clip_rect_); |
1152 } | 1159 } |
1153 #endif // !NP_NO_QUICKDRAW | 1160 #endif // !NP_NO_QUICKDRAW |
OLD | NEW |