Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: webkit/glue/plugins/plugin_host.cc

Issue 255061: Re-land http://codereview.chromium.org/211031 with a bug opened... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/default_plugin/default_plugin_shared.h ('k') | webkit/glue/plugins/plugin_instance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // Pepper API support should be turned on for this module. 5 // Pepper API support should be turned on for this module.
6 #define PEPPER_APIS_ENABLED 6 #define PEPPER_APIS_ENABLED
7 7
8 #include "webkit/glue/plugins/plugin_host.h" 8 #include "webkit/glue/plugins/plugin_host.h"
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 rv = NPERR_NO_ERROR; 780 rv = NPERR_NO_ERROR;
781 break; 781 break;
782 } 782 }
783 case default_plugin::kMissingPluginStatusStart + 783 case default_plugin::kMissingPluginStatusStart +
784 default_plugin::MISSING_PLUGIN_AVAILABLE: 784 default_plugin::MISSING_PLUGIN_AVAILABLE:
785 // fall through 785 // fall through
786 case default_plugin::kMissingPluginStatusStart + 786 case default_plugin::kMissingPluginStatusStart +
787 default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD: 787 default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD:
788 { 788 {
789 // This is a hack for the default plugin to send notification to renderer. 789 // This is a hack for the default plugin to send notification to renderer.
790 // Because we will check if the plugin is default plugin, we don't need 790 // Even though we check if the plugin is the default plugin, we still need
791 // to worry about future standard change that may conflict with the 791 // to worry about future standard change that may conflict with the
792 // variable definition. 792 // variable definition, in order to avoid duplicate case clauses in this
793 // big switch statement.
793 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); 794 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
794 if (plugin->plugin_lib()->plugin_info().path.value() == 795 if (plugin->plugin_lib()->plugin_info().path.value() ==
795 kDefaultPluginLibraryName) { 796 kDefaultPluginLibraryName) {
796 plugin->webplugin()->OnMissingPluginStatus( 797 plugin->webplugin()->OnMissingPluginStatus(
797 variable - default_plugin::kMissingPluginStatusStart); 798 variable - default_plugin::kMissingPluginStatusStart);
798 } 799 }
799 break; 800 break;
800 } 801 }
801 #if defined(OS_MACOSX) 802 #if defined(OS_MACOSX)
803 case NPNVpluginDrawingModel:
804 {
805 // return the drawing model that was negotiated when we initialized.
806 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
807 *reinterpret_cast<int*>(value) = plugin->drawing_model();
808 rv = NPERR_NO_ERROR;
809 break;
810 }
802 case NPNVsupportsQuickDrawBool: 811 case NPNVsupportsQuickDrawBool:
803 { 812 {
804 // we do not support the QuickDraw drawing model 813 // we do not admit to supporting the QuickDraw drawing model.
805 NPBool* supports_qd = reinterpret_cast<NPBool*>(value); 814 NPBool* supports_qd = reinterpret_cast<NPBool*>(value);
806 *supports_qd = FALSE; 815 *supports_qd = FALSE;
807 rv = NPERR_NO_ERROR; 816 rv = NPERR_NO_ERROR;
808 break; 817 break;
809 } 818 }
810 case NPNVsupportsCoreGraphicsBool: 819 case NPNVsupportsCoreGraphicsBool:
820 case NPNVsupportsCarbonBool:
811 { 821 {
812 // we do support (and in fact require) the CoreGraphics drawing model 822 // we do support these drawing and event models.
813 NPBool* supports_cg = reinterpret_cast<NPBool*>(value); 823 NPBool* supports_model = reinterpret_cast<NPBool*>(value);
814 *supports_cg = TRUE; 824 *supports_model = TRUE;
825 rv = NPERR_NO_ERROR;
826 break;
827 }
828 case NPNVsupportsOpenGLBool:
829 case NPNVsupportsCoreAnimationBool:
830 case NPNVsupportsCocoaBool:
831 {
832 // we do not support these drawing and event models.
833 NPBool* supports_model = reinterpret_cast<NPBool*>(value);
834 *supports_model = FALSE;
815 rv = NPERR_NO_ERROR; 835 rv = NPERR_NO_ERROR;
816 break; 836 break;
817 } 837 }
818 #endif 838 #endif
819 #if defined(PEPPER_APIS_ENABLED) 839 #if defined(PEPPER_APIS_ENABLED)
820 case NPNVInitializeRenderContextFunc: 840 case NPNVInitializeRenderContextFunc:
821 { 841 {
822 NPInitializeRenderContextPtr* func = 842 NPInitializeRenderContextPtr* func =
823 reinterpret_cast<NPInitializeRenderContextPtr*>(value); 843 reinterpret_cast<NPInitializeRenderContextPtr*>(value);
824 *func = InitializeRenderContext; 844 *func = InitializeRenderContext;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 // the stack 897 // the stack
878 // TODO: implement me 898 // TODO: implement me
879 DLOG(INFO) << "NPN_SetValue(NPPVJavascriptPushCallerBool) is not implemented ."; 899 DLOG(INFO) << "NPN_SetValue(NPPVJavascriptPushCallerBool) is not implemented .";
880 return NPERR_GENERIC_ERROR; 900 return NPERR_GENERIC_ERROR;
881 case NPPVpluginKeepLibraryInMemory: 901 case NPPVpluginKeepLibraryInMemory:
882 // Tells browser that plugin library should live longer than usual. 902 // Tells browser that plugin library should live longer than usual.
883 // TODO: implement me 903 // TODO: implement me
884 DLOG(INFO) << "NPN_SetValue(NPPVpluginKeepLibraryInMemory) is not implemente d."; 904 DLOG(INFO) << "NPN_SetValue(NPPVpluginKeepLibraryInMemory) is not implemente d.";
885 return NPERR_GENERIC_ERROR; 905 return NPERR_GENERIC_ERROR;
886 #if defined(OS_MACOSX) 906 #if defined(OS_MACOSX)
887 case NPNVpluginDrawingModel: 907 case NPPVpluginDrawingModel:
888 // we only support the CoreGraphics drawing model 908 {
889 if (reinterpret_cast<int>(value) == NPDrawingModelCoreGraphics) 909 // we only admit to supporting the CoreGraphics drawing model. The logic
910 // here is that our QuickDraw plugin support is so rudimentary that we
911 // only want to use it as a fallback to keep plugins from crashing: if
912 // a plugin knows enough to ask, we want them to use CoreGraphics.
913 int model = reinterpret_cast<int>(value);
914 if (model == NPDrawingModelCoreGraphics) {
915 plugin->set_drawing_model(model);
890 return NPERR_NO_ERROR; 916 return NPERR_NO_ERROR;
917 }
891 return NPERR_GENERIC_ERROR; 918 return NPERR_GENERIC_ERROR;
919 }
920 case NPPVpluginEventModel:
921 {
922 // we only support the Carbon event model
923 int model = reinterpret_cast<int>(value);
924 switch (model) {
925 case NPNVsupportsCarbonBool:
926 plugin->set_event_model(model);
927 return NPERR_NO_ERROR;
928 break;
929 }
930 return NPERR_GENERIC_ERROR;
931 }
892 #endif 932 #endif
893 default: 933 default:
894 // TODO: implement me 934 // TODO: implement me
895 DLOG(INFO) << "NPN_SetValue(" << variable << ") is not implemented."; 935 DLOG(INFO) << "NPN_SetValue(" << variable << ") is not implemented.";
896 break; 936 break;
897 } 937 }
898 938
899 NOTREACHED(); 939 NOTREACHED();
900 return NPERR_GENERIC_ERROR; 940 return NPERR_GENERIC_ERROR;
901 } 941 }
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 uint32_t *plen) { 1096 uint32_t *plen) {
1057 if (!id || !protocol || !host || !scheme || !realm || !username || 1097 if (!id || !protocol || !host || !scheme || !realm || !username ||
1058 !ulen || !password || !plen) 1098 !ulen || !password || !plen)
1059 return NPERR_INVALID_PARAM; 1099 return NPERR_INVALID_PARAM;
1060 1100
1061 // TODO: implement me (bug 23928) 1101 // TODO: implement me (bug 23928)
1062 return NPERR_GENERIC_ERROR; 1102 return NPERR_GENERIC_ERROR;
1063 } 1103 }
1064 1104
1065 } // extern "C" 1105 } // extern "C"
OLDNEW
« no previous file with comments | « webkit/default_plugin/default_plugin_shared.h ('k') | webkit/glue/plugins/plugin_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698