| 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 "chrome/plugin/npobject_util.h" | 5 #include "chrome/plugin/npobject_util.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) |
| 7 #include "chrome/common/plugin_messages.h" | 8 #include "chrome/common/plugin_messages.h" |
| 8 #include "chrome/common/win_util.h" | 9 #include "chrome/common/win_util.h" |
| 10 #endif |
| 11 |
| 9 #include "chrome/plugin/npobject_proxy.h" | 12 #include "chrome/plugin/npobject_proxy.h" |
| 10 #include "chrome/plugin/plugin_channel_base.h" | 13 #include "chrome/plugin/plugin_channel_base.h" |
| 11 #include "webkit/glue/plugins/nphostapi.h" | 14 #include "webkit/glue/plugins/nphostapi.h" |
| 12 #include "webkit/glue/plugins/plugin_host.h" | 15 #include "webkit/glue/plugins/plugin_host.h" |
| 13 #include "webkit/glue/webkit_glue.h" | 16 #include "webkit/glue/webkit_glue.h" |
| 14 | 17 |
| 15 // true if the current process is a plugin process, false if it's a renderer | 18 // true if the current process is a plugin process, false if it's a renderer |
| 16 // process. | 19 // process. |
| 17 static bool g_plugin_process; | 20 static bool g_plugin_process; |
| 18 | 21 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 void PatchNPNFunctions() { | 120 void PatchNPNFunctions() { |
| 118 g_plugin_process = true; | 121 g_plugin_process = true; |
| 119 NPNetscapeFuncs* funcs = GetHostFunctions(); | 122 NPNetscapeFuncs* funcs = GetHostFunctions(); |
| 120 NPAPI::PluginHost::Singleton()->PatchNPNetscapeFuncs(funcs); | 123 NPAPI::PluginHost::Singleton()->PatchNPNetscapeFuncs(funcs); |
| 121 } | 124 } |
| 122 | 125 |
| 123 bool IsPluginProcess() { | 126 bool IsPluginProcess() { |
| 124 return g_plugin_process; | 127 return g_plugin_process; |
| 125 } | 128 } |
| 126 | 129 |
| 130 #if defined(OS_WIN) |
| 127 void CreateNPIdentifierParam(NPIdentifier id, NPIdentifier_Param* param) { | 131 void CreateNPIdentifierParam(NPIdentifier id, NPIdentifier_Param* param) { |
| 128 param->identifier = id; | 132 param->identifier = id; |
| 129 } | 133 } |
| 130 | 134 |
| 131 NPIdentifier CreateNPIdentifier(const NPIdentifier_Param& param) { | 135 NPIdentifier CreateNPIdentifier(const NPIdentifier_Param& param) { |
| 132 return param.identifier; | 136 return param.identifier; |
| 133 } | 137 } |
| 134 | 138 |
| 135 void CreateNPVariantParam(const NPVariant& variant, | 139 void CreateNPVariantParam(const NPVariant& variant, |
| 136 PluginChannelBase* channel, | 140 PluginChannelBase* channel, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 break; | 240 break; |
| 237 case NPVARIANT_PARAM_OBJECT_POINTER: | 241 case NPVARIANT_PARAM_OBJECT_POINTER: |
| 238 result->type = NPVariantType_Object; | 242 result->type = NPVariantType_Object; |
| 239 result->value.objectValue = static_cast<NPObject*>(param.npobject_pointer)
; | 243 result->value.objectValue = static_cast<NPObject*>(param.npobject_pointer)
; |
| 240 NPN_RetainObject(result->value.objectValue); | 244 NPN_RetainObject(result->value.objectValue); |
| 241 break; | 245 break; |
| 242 default: | 246 default: |
| 243 NOTREACHED(); | 247 NOTREACHED(); |
| 244 } | 248 } |
| 245 } | 249 } |
| 246 | 250 #endif |
| OLD | NEW |