| 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 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "chrome/common/plugin_messages.h" | 8 #include "chrome/common/plugin_messages.h" |
| 9 #include "chrome/plugin/npobject_proxy.h" | 9 #include "chrome/plugin/npobject_proxy.h" |
| 10 #include "chrome/plugin/plugin_channel_base.h" | 10 #include "chrome/plugin/plugin_channel_base.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 static bool NPN_EvaluatePatch(NPP npp, | 79 static bool NPN_EvaluatePatch(NPP npp, |
| 80 NPObject *npobj, | 80 NPObject *npobj, |
| 81 NPString *script, | 81 NPString *script, |
| 82 NPVariant *result) { | 82 NPVariant *result) { |
| 83 return NPObjectProxy::NPNEvaluate(npp, npobj, script, result); | 83 return NPObjectProxy::NPNEvaluate(npp, npobj, script, result); |
| 84 } | 84 } |
| 85 | 85 |
| 86 | 86 |
| 87 static void NPN_SetExceptionPatch(NPObject *obj, | 87 static void NPN_SetExceptionPatch(NPObject *obj, const NPUTF8 *message) { |
| 88 const NPUTF8 *message) { | 88 std::string message_str(message); |
| 89 return NPObjectProxy::NPNSetException(obj, message); | 89 if (IsPluginProcess()) { |
| 90 PluginChannelBase* renderer_channel = |
| 91 PluginChannelBase::GetCurrentChannel(); |
| 92 if (renderer_channel) |
| 93 renderer_channel->Send(new PluginHostMsg_SetException(message_str)); |
| 94 } else { |
| 95 WebBindings::setException(obj, message_str.c_str()); |
| 96 } |
| 90 } | 97 } |
| 91 | 98 |
| 92 static bool NPN_EnumeratePatch(NPP npp, NPObject *obj, | 99 static bool NPN_EnumeratePatch(NPP npp, NPObject *obj, |
| 93 NPIdentifier **identifier, uint32_t *count) { | 100 NPIdentifier **identifier, uint32_t *count) { |
| 94 return NPObjectProxy::NPNEnumerate(obj, identifier, count); | 101 return NPObjectProxy::NPNEnumerate(obj, identifier, count); |
| 95 } | 102 } |
| 96 | 103 |
| 97 // The overrided table of functions provided to the plugin. | 104 // The overrided table of functions provided to the plugin. |
| 98 NPNetscapeFuncs *GetHostFunctions() { | 105 NPNetscapeFuncs *GetHostFunctions() { |
| 99 static bool init = false; | 106 static bool init = false; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 case NPVARIANT_PARAM_OBJECT_POINTER: | 256 case NPVARIANT_PARAM_OBJECT_POINTER: |
| 250 result->type = NPVariantType_Object; | 257 result->type = NPVariantType_Object; |
| 251 result->value.objectValue = | 258 result->value.objectValue = |
| 252 reinterpret_cast<NPObject*>(param.npobject_pointer); | 259 reinterpret_cast<NPObject*>(param.npobject_pointer); |
| 253 WebBindings::retainObject(result->value.objectValue); | 260 WebBindings::retainObject(result->value.objectValue); |
| 254 break; | 261 break; |
| 255 default: | 262 default: |
| 256 NOTREACHED(); | 263 NOTREACHED(); |
| 257 } | 264 } |
| 258 } | 265 } |
| OLD | NEW |