| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/common/npobject_util.h" | 5 #include "content/common/npobject_util.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "content/common/np_channel_base.h" | 8 #include "content/common/np_channel_base.h" |
| 9 #include "content/common/npobject_proxy.h" | 9 #include "content/common/npobject_proxy.h" |
| 10 #include "content/common/plugin_messages.h" | 10 #include "content/common/plugin_messages.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 NPString *script, | 80 NPString *script, |
| 81 NPVariant *result) { | 81 NPVariant *result) { |
| 82 return NPObjectProxy::NPNEvaluate(npp, npobj, script, result); | 82 return NPObjectProxy::NPNEvaluate(npp, npobj, script, result); |
| 83 } | 83 } |
| 84 | 84 |
| 85 | 85 |
| 86 static void NPN_SetExceptionPatch(NPObject *obj, const NPUTF8 *message) { | 86 static void NPN_SetExceptionPatch(NPObject *obj, const NPUTF8 *message) { |
| 87 std::string message_str(message); | 87 std::string message_str(message); |
| 88 if (IsPluginProcess()) { | 88 if (IsPluginProcess()) { |
| 89 NPChannelBase* renderer_channel = NPChannelBase::GetCurrentChannel(); | 89 NPChannelBase* renderer_channel = NPChannelBase::GetCurrentChannel(); |
| 90 if (renderer_channel) | 90 if (renderer_channel) { |
| 91 renderer_channel->Send(new PluginHostMsg_SetException(message_str)); | 91 if (obj->_class != NPObjectProxy::npclass()) { |
| 92 int route_id = MSG_ROUTING_NONE; |
| 93 // Determine the route id of NPObjectProxy instance in renderer process |
| 94 // It is the same as the route id of NPObjectStub instance in plugin |
| 95 // process. |
| 96 route_id = renderer_channel->GetExistingRouteForNPObjectStub(obj); |
| 97 renderer_channel->Send(new NPObjectMsg_SetException(route_id, |
| 98 message_str)); |
| 99 } else { |
| 100 renderer_channel->Send(new PluginHostMsg_SetException(message_str)); |
| 101 } |
| 102 } |
| 92 } else { | 103 } else { |
| 93 WebBindings::setException(obj, message_str.c_str()); | 104 WebBindings::setException(obj, message_str.c_str()); |
| 94 } | 105 } |
| 95 } | 106 } |
| 96 | 107 |
| 97 static bool NPN_EnumeratePatch(NPP npp, NPObject *obj, | 108 static bool NPN_EnumeratePatch(NPP npp, NPObject *obj, |
| 98 NPIdentifier **identifier, uint32_t *count) { | 109 NPIdentifier **identifier, uint32_t *count) { |
| 99 return NPObjectProxy::NPNEnumerate(obj, identifier, count); | 110 return NPObjectProxy::NPNEnumerate(obj, identifier, count); |
| 100 } | 111 } |
| 101 | 112 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 result->type = NPVariantType_Object; | 290 result->type = NPVariantType_Object; |
| 280 result->value.objectValue = npobject_base->GetUnderlyingNPObject(); | 291 result->value.objectValue = npobject_base->GetUnderlyingNPObject(); |
| 281 WebBindings::retainObject(result->value.objectValue); | 292 WebBindings::retainObject(result->value.objectValue); |
| 282 break; | 293 break; |
| 283 } | 294 } |
| 284 default: | 295 default: |
| 285 NOTREACHED(); | 296 NOTREACHED(); |
| 286 } | 297 } |
| 287 return true; | 298 return true; |
| 288 } | 299 } |
| OLD | NEW |