| OLD | NEW |
| 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 #include "webkit/glue/plugins/plugin_host.h" | 5 #include "webkit/glue/plugins/plugin_host.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 777 // variable definition. | 777 // variable definition. |
| 778 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); | 778 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
| 779 if (plugin->plugin_lib()->plugin_info().path.value() == | 779 if (plugin->plugin_lib()->plugin_info().path.value() == |
| 780 kDefaultPluginLibraryName) { | 780 kDefaultPluginLibraryName) { |
| 781 plugin->webplugin()->OnMissingPluginStatus( | 781 plugin->webplugin()->OnMissingPluginStatus( |
| 782 variable - default_plugin::kMissingPluginStatusStart); | 782 variable - default_plugin::kMissingPluginStatusStart); |
| 783 } | 783 } |
| 784 break; | 784 break; |
| 785 } | 785 } |
| 786 #if defined(OS_MACOSX) | 786 #if defined(OS_MACOSX) |
| 787 case NPNVpluginDrawingModel: |
| 788 { |
| 789 // return the drawing model that was negotiated when we initialized |
| 790 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
| 791 *reinterpret_cast<int*>(value) = plugin->drawing_model(); |
| 792 rv = NPERR_NO_ERROR; |
| 793 break; |
| 794 } |
| 787 case NPNVsupportsQuickDrawBool: | 795 case NPNVsupportsQuickDrawBool: |
| 788 { | 796 { |
| 789 // we do not support the QuickDraw drawing model | 797 // we do not support the QuickDraw drawing model |
| 790 NPBool* supports_qd = reinterpret_cast<NPBool*>(value); | 798 NPBool* supports_qd = reinterpret_cast<NPBool*>(value); |
| 791 *supports_qd = FALSE; | 799 *supports_qd = FALSE; |
| 792 rv = NPERR_NO_ERROR; | 800 rv = NPERR_NO_ERROR; |
| 793 break; | 801 break; |
| 794 } | 802 } |
| 795 case NPNVsupportsCoreGraphicsBool: | 803 case NPNVsupportsCoreGraphicsBool: |
| 796 { | 804 { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 844 // the stack | 852 // the stack |
| 845 // TODO: implement me | 853 // TODO: implement me |
| 846 DLOG(INFO) << "NPN_SetValue(NPPVJavascriptPushCallerBool) is not implemented
."; | 854 DLOG(INFO) << "NPN_SetValue(NPPVJavascriptPushCallerBool) is not implemented
."; |
| 847 return NPERR_GENERIC_ERROR; | 855 return NPERR_GENERIC_ERROR; |
| 848 case NPPVpluginKeepLibraryInMemory: | 856 case NPPVpluginKeepLibraryInMemory: |
| 849 // Tells browser that plugin library should live longer than usual. | 857 // Tells browser that plugin library should live longer than usual. |
| 850 // TODO: implement me | 858 // TODO: implement me |
| 851 DLOG(INFO) << "NPN_SetValue(NPPVpluginKeepLibraryInMemory) is not implemente
d."; | 859 DLOG(INFO) << "NPN_SetValue(NPPVpluginKeepLibraryInMemory) is not implemente
d."; |
| 852 return NPERR_GENERIC_ERROR; | 860 return NPERR_GENERIC_ERROR; |
| 853 #if defined(OS_MACOSX) | 861 #if defined(OS_MACOSX) |
| 854 case NPNVpluginDrawingModel: | 862 case NPPVpluginDrawingModel: |
| 855 // we only support the CoreGraphics drawing model | 863 { |
| 856 if (reinterpret_cast<int>(value) == NPDrawingModelCoreGraphics) | 864 // we only admit to supporting the CoreGraphics drawing model. The logic |
| 865 // here is that our QuickDraw plugin support is so rudimentary that we |
| 866 // only want to use it as a fallback to keep plugins from crashing: if |
| 867 // a plugin knows enough to ask, we want them to use CoreGraphics. |
| 868 int model = reinterpret_cast<int>(value); |
| 869 if (model == NPDrawingModelCoreGraphics) { |
| 870 plugin->set_drawing_model(model); |
| 857 return NPERR_NO_ERROR; | 871 return NPERR_NO_ERROR; |
| 872 } |
| 858 return NPERR_GENERIC_ERROR; | 873 return NPERR_GENERIC_ERROR; |
| 874 } |
| 875 case NPPVpluginEventModel: |
| 876 { |
| 877 // we only support the Carbon event model |
| 878 int model = reinterpret_cast<int>(value); |
| 879 switch (model) { |
| 880 case NPNVsupportsCarbonBool: |
| 881 plugin->set_event_model(model); |
| 882 return NPERR_NO_ERROR; |
| 883 break; |
| 884 } |
| 885 return NPERR_GENERIC_ERROR; |
| 886 } |
| 859 #endif | 887 #endif |
| 860 default: | 888 default: |
| 861 // TODO: implement me | 889 // TODO: implement me |
| 862 DLOG(INFO) << "NPN_SetValue(" << variable << ") is not implemented."; | 890 LOG(WARNING) << "NPN_SetValue(" << variable << ") is not implemented."; |
| 863 break; | 891 break; |
| 864 } | 892 } |
| 865 | 893 |
| 866 NOTREACHED(); | 894 NOTREACHED(); |
| 867 return NPERR_GENERIC_ERROR; | 895 return NPERR_GENERIC_ERROR; |
| 868 } | 896 } |
| 869 | 897 |
| 870 void *NPN_GetJavaEnv() { | 898 void *NPN_GetJavaEnv() { |
| 871 // TODO: implement me | 899 // TODO: implement me |
| 872 DLOG(INFO) << "NPN_GetJavaEnv is not implemented."; | 900 DLOG(INFO) << "NPN_GetJavaEnv is not implemented."; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 896 void NPN_PluginThreadAsyncCall(NPP id, | 924 void NPN_PluginThreadAsyncCall(NPP id, |
| 897 void (*func)(void *), | 925 void (*func)(void *), |
| 898 void *userData) { | 926 void *userData) { |
| 899 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); | 927 scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); |
| 900 if (plugin) { | 928 if (plugin) { |
| 901 plugin->PluginThreadAsyncCall(func, userData); | 929 plugin->PluginThreadAsyncCall(func, userData); |
| 902 } | 930 } |
| 903 } | 931 } |
| 904 | 932 |
| 905 } // extern "C" | 933 } // extern "C" |
| OLD | NEW |