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 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 scoped_refptr<PluginInstance> plugin(FindInstance(id)); | 796 scoped_refptr<PluginInstance> plugin(FindInstance(id)); |
797 if (!plugin.get()) { | 797 if (!plugin.get()) { |
798 NOTREACHED(); | 798 NOTREACHED(); |
799 return NPERR_INVALID_INSTANCE_ERROR; | 799 return NPERR_INVALID_INSTANCE_ERROR; |
800 } | 800 } |
801 *reinterpret_cast<int*>(value) = plugin->drawing_model(); | 801 *reinterpret_cast<int*>(value) = plugin->drawing_model(); |
802 rv = NPERR_NO_ERROR; | 802 rv = NPERR_NO_ERROR; |
803 break; | 803 break; |
804 } | 804 } |
805 case NPNVsupportsCoreGraphicsBool: | 805 case NPNVsupportsCoreGraphicsBool: |
806 #ifndef NP_NO_CARBON | |
807 case NPNVsupportsCarbonBool: | |
808 #endif | |
809 case NPNVsupportsCocoaBool: { | 806 case NPNVsupportsCocoaBool: { |
810 // These drawing and event models are always supported. | 807 // These drawing and event models are always supported. |
811 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 808 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
812 *supports_model = true; | 809 *supports_model = true; |
813 rv = NPERR_NO_ERROR; | 810 rv = NPERR_NO_ERROR; |
814 break; | 811 break; |
815 } | 812 } |
816 case NPNVsupportsInvalidatingCoreAnimationBool: | 813 case NPNVsupportsInvalidatingCoreAnimationBool: |
817 case NPNVsupportsCoreAnimationBool: { | 814 case NPNVsupportsCoreAnimationBool: { |
818 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 815 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
819 *supports_model = webkit::npapi::SupportsCoreAnimationPlugins(); | 816 *supports_model = webkit::npapi::SupportsCoreAnimationPlugins(); |
820 rv = NPERR_NO_ERROR; | 817 rv = NPERR_NO_ERROR; |
821 break; | 818 break; |
822 } | 819 } |
| 820 #ifndef NP_NO_CARBON |
| 821 case NPNVsupportsCarbonBool: |
| 822 #endif |
823 #ifndef NP_NO_QUICKDRAW | 823 #ifndef NP_NO_QUICKDRAW |
824 case NPNVsupportsQuickDrawBool: | 824 case NPNVsupportsQuickDrawBool: |
825 #endif | 825 #endif |
826 case NPNVsupportsOpenGLBool: { | 826 case NPNVsupportsOpenGLBool: { |
827 // These drawing models are never supported. OpenGL was never widely | 827 // These models are never supported. OpenGL was never widely supported, |
828 // supported, and QuickDraw has been deprecated for years. | 828 // and QuickDraw and Carbon have been deprecated for quite some time. |
829 NPBool* supports_model = reinterpret_cast<NPBool*>(value); | 829 NPBool* supports_model = reinterpret_cast<NPBool*>(value); |
830 *supports_model = false; | 830 *supports_model = false; |
831 rv = NPERR_NO_ERROR; | 831 rv = NPERR_NO_ERROR; |
832 break; | 832 break; |
833 } | 833 } |
834 case NPNVsupportsCompositingCoreAnimationPluginsBool: { | 834 case NPNVsupportsCompositingCoreAnimationPluginsBool: { |
835 NPBool* supports_compositing = reinterpret_cast<NPBool*>(value); | 835 NPBool* supports_compositing = reinterpret_cast<NPBool*>(value); |
836 *supports_compositing = | 836 *supports_compositing = |
837 webkit::npapi::SupportsCoreAnimationPlugins() && | 837 webkit::npapi::SupportsCoreAnimationPlugins() && |
838 webkit::npapi::UsingCompositedCoreAnimationPlugins(); | 838 webkit::npapi::UsingCompositedCoreAnimationPlugins(); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 if (model == NPDrawingModelCoreGraphics || | 903 if (model == NPDrawingModelCoreGraphics || |
904 ((model == NPDrawingModelInvalidatingCoreAnimation || | 904 ((model == NPDrawingModelInvalidatingCoreAnimation || |
905 model == NPDrawingModelCoreAnimation) && | 905 model == NPDrawingModelCoreAnimation) && |
906 webkit::npapi::SupportsCoreAnimationPlugins())) { | 906 webkit::npapi::SupportsCoreAnimationPlugins())) { |
907 plugin->set_drawing_model(static_cast<NPDrawingModel>(model)); | 907 plugin->set_drawing_model(static_cast<NPDrawingModel>(model)); |
908 return NPERR_NO_ERROR; | 908 return NPERR_NO_ERROR; |
909 } | 909 } |
910 return NPERR_GENERIC_ERROR; | 910 return NPERR_GENERIC_ERROR; |
911 } | 911 } |
912 case NPPVpluginEventModel: { | 912 case NPPVpluginEventModel: { |
913 // we support Carbon and Cocoa event models | 913 // Only the Cocoa event model is supported. |
914 int model = reinterpret_cast<int>(value); | 914 int model = reinterpret_cast<int>(value); |
915 switch (model) { | 915 if (model == NPEventModelCocoa) { |
916 #ifndef NP_NO_CARBON | 916 plugin->set_event_model(static_cast<NPEventModel>(model)); |
917 case NPEventModelCarbon: | 917 return NPERR_NO_ERROR; |
918 #endif | |
919 case NPEventModelCocoa: | |
920 plugin->set_event_model(static_cast<NPEventModel>(model)); | |
921 return NPERR_NO_ERROR; | |
922 break; | |
923 } | 918 } |
924 return NPERR_GENERIC_ERROR; | 919 return NPERR_GENERIC_ERROR; |
925 } | 920 } |
926 #endif | 921 #endif |
927 default: | 922 default: |
928 // TODO: implement me | 923 // TODO: implement me |
929 DVLOG(1) << "NPN_SetValue(" << variable << ") is not implemented."; | 924 DVLOG(1) << "NPN_SetValue(" << variable << ") is not implemented."; |
930 break; | 925 break; |
931 } | 926 } |
932 | 927 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 } | 1128 } |
1134 | 1129 |
1135 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { | 1130 void NPN_URLRedirectResponse(NPP instance, void* notify_data, NPBool allow) { |
1136 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); | 1131 scoped_refptr<PluginInstance> plugin(FindInstance(instance)); |
1137 if (plugin.get()) { | 1132 if (plugin.get()) { |
1138 plugin->URLRedirectResponse(!!allow, notify_data); | 1133 plugin->URLRedirectResponse(!!allow, notify_data); |
1139 } | 1134 } |
1140 } | 1135 } |
1141 | 1136 |
1142 } // extern "C" | 1137 } // extern "C" |
OLD | NEW |