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 #include "webkit/plugins/npapi/plugin_host.h" | 5 #include "webkit/plugins/npapi/plugin_host.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 // return the drawing model that was negotiated when we initialized. | 791 // return the drawing model that was negotiated when we initialized. |
792 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 792 scoped_refptr<PluginInstance> plugin(FindInstance(id)); |
793 if (!plugin.get()) { | 793 if (!plugin.get()) { |
794 NOTREACHED(); | 794 NOTREACHED(); |
795 return NPERR_INVALID_INSTANCE_ERROR; | 795 return NPERR_INVALID_INSTANCE_ERROR; |
796 } | 796 } |
797 *reinterpret_cast<int*>(value) = plugin->drawing_model(); | 797 *reinterpret_cast<int*>(value) = plugin->drawing_model(); |
798 rv = NPERR_NO_ERROR; | 798 rv = NPERR_NO_ERROR; |
799 break; | 799 break; |
800 } | 800 } |
801 #ifndef NP_NO_QUICKDRAW | |
802 case NPNVsupportsQuickDrawBool: { | |
803 // We do not admit to supporting the QuickDraw drawing model. The logic | |
804 // here is that our QuickDraw plugin support is so rudimentary that we | |
805 // only want to use it as a fallback to keep plugins from crashing: if a | |
806 // plugin knows enough to ask, we want them to use CoreGraphics. | |
807 NPBool* supports_qd = reinterpret_cast<NPBool*>(value); | |
808 *supports_qd = false; | |
809 rv = NPERR_NO_ERROR; | |
810 break; | |
811 } | |
812 #endif | |
813 case NPNVsupportsCoreGraphicsBool: | 801 case NPNVsupportsCoreGraphicsBool: |
814 #ifndef NP_NO_CARBON | 802 #ifndef NP_NO_CARBON |
815 case NPNVsupportsCarbonBool: | 803 case NPNVsupportsCarbonBool: |
816 #endif | 804 #endif |
817 case NPNVsupportsCocoaBool: { | 805 case NPNVsupportsCocoaBool: { |
818 // we do support these drawing and event models. | 806 // These drawing and event models are always supported. |
819 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 807 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
820 *supports_model = true; | 808 *supports_model = true; |
821 rv = NPERR_NO_ERROR; | 809 rv = NPERR_NO_ERROR; |
822 break; | 810 break; |
823 } | 811 } |
824 case NPNVsupportsCoreAnimationBool: { | 812 case NPNVsupportsCoreAnimationBool: { |
825 // We only support the Core Animation model on 10.6 and higher | 813 // We only support the Core Animation model on 10.6 and higher |
826 // TODO(stuartmorgan): Once existing CA plugins have implemented the | 814 // TODO(stuartmorgan): Once existing CA plugins have implemented the |
827 // invalidating version, remove support for this one. | 815 // invalidating version, remove support for this one. |
828 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 816 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
829 *supports_model = webkit::npapi::SupportsSharingAcceleratedSurfaces() ? | 817 *supports_model = webkit::npapi::SupportsSharingAcceleratedSurfaces() ? |
830 true : false; | 818 true : false; |
831 rv = NPERR_NO_ERROR; | 819 rv = NPERR_NO_ERROR; |
832 break; | 820 break; |
833 } | 821 } |
834 case NPNVsupportsInvalidatingCoreAnimationBool: { | 822 case NPNVsupportsInvalidatingCoreAnimationBool: { |
835 // The composited code path for this model only works on 10.6 and higher. | 823 // The composited code path for this model only works on 10.6 and higher. |
836 // The old direct-to-screen code path supports 10.5. | 824 // The old direct-to-screen code path supports 10.5. |
837 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 825 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
838 bool composited = webkit::npapi::UsingCompositedCoreAnimationPlugins(); | 826 bool composited = webkit::npapi::UsingCompositedCoreAnimationPlugins(); |
839 *supports_model = composited ? | 827 *supports_model = composited ? |
840 webkit::npapi::SupportsSharingAcceleratedSurfaces() : true; | 828 webkit::npapi::SupportsSharingAcceleratedSurfaces() : true; |
841 rv = NPERR_NO_ERROR; | 829 rv = NPERR_NO_ERROR; |
842 break; | 830 break; |
843 } | 831 } |
| 832 #ifndef NP_NO_QUICKDRAW |
| 833 case NPNVsupportsQuickDrawBool: |
| 834 #endif |
844 case NPNVsupportsOpenGLBool: { | 835 case NPNVsupportsOpenGLBool: { |
845 // This drawing model was never widely supported, and we don't plan to | 836 // These drawing models are never supported. OpenGL was never widely |
846 // support it. | 837 // supported, and QuickDraw has been deprecated for years. |
847 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 838 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
848 *supports_model = false; | 839 *supports_model = false; |
849 rv = NPERR_NO_ERROR; | 840 rv = NPERR_NO_ERROR; |
850 break; | 841 break; |
851 } | 842 } |
852 case NPNVsupportsCompositingCoreAnimationPluginsBool: { | 843 case NPNVsupportsCompositingCoreAnimationPluginsBool: { |
853 NPBool* supports_compositing = reinterpret_cast<NPBool*>(value); | 844 NPBool* supports_compositing = reinterpret_cast<NPBool*>(value); |
854 *supports_compositing = | 845 *supports_compositing = |
855 webkit::npapi::UsingCompositedCoreAnimationPlugins(); | 846 webkit::npapi::UsingCompositedCoreAnimationPlugins(); |
856 rv = NPERR_NO_ERROR; | 847 rv = NPERR_NO_ERROR; |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1152 } | 1143 } |
1153 | 1144 |
1154 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 1145 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
1155 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); | 1146 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); |
1156 if (plugin.get()) { | 1147 if (plugin.get()) { |
1157 plugin->URLRedirectResponse(!!allow, notify_data); | 1148 plugin->URLRedirectResponse(!!allow, notify_data); |
1158 } | 1149 } |
1159 } | 1150 } |
1160 | 1151 |
1161 } // extern "C" | 1152 } // extern "C" |
OLD | NEW |