| 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_proxy.h" | 5 #include "chrome/plugin/npobject_proxy.h" |
| 6 | 6 |
| 7 #include "base/waitable_event.h" | 7 #include "base/waitable_event.h" |
| 8 #include "chrome/common/plugin_messages.h" | 8 #include "chrome/common/plugin_messages.h" |
| 9 #include "chrome/common/win_util.h" | 9 #include "chrome/common/win_util.h" |
| 10 #include "chrome/plugin/npobject_util.h" | 10 #include "chrome/plugin/npobject_util.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 bool result = false; | 110 bool result = false; |
| 111 NPObjectProxy* proxy = GetProxy(obj); | 111 NPObjectProxy* proxy = GetProxy(obj); |
| 112 | 112 |
| 113 if (!proxy) { | 113 if (!proxy) { |
| 114 return obj->_class->hasMethod(obj, name); | 114 return obj->_class->hasMethod(obj, name); |
| 115 } | 115 } |
| 116 | 116 |
| 117 NPIdentifier_Param name_param; | 117 NPIdentifier_Param name_param; |
| 118 CreateNPIdentifierParam(name, &name_param); | 118 CreateNPIdentifierParam(name, &name_param); |
| 119 | 119 |
| 120 proxy->Send(new NPObjectMsg_HasMethod(proxy->route_id(), name_param, &result))
; | 120 proxy->Send(new NPObjectMsg_HasMethod(proxy->route_id(), name_param, |
| 121 &result)); |
| 121 return result; | 122 return result; |
| 122 } | 123 } |
| 123 | 124 |
| 124 bool NPObjectProxy::NPInvoke(NPObject *obj, | 125 bool NPObjectProxy::NPInvoke(NPObject *obj, |
| 125 NPIdentifier name, | 126 NPIdentifier name, |
| 126 const NPVariant *args, | 127 const NPVariant *args, |
| 127 uint32_t arg_count, | 128 uint32_t arg_count, |
| 128 NPVariant *result) { | 129 NPVariant *result) { |
| 129 return NPInvokePrivate(0, obj, false, name, args, arg_count, result); | 130 return NPInvokePrivate(0, obj, false, name, args, arg_count, result); |
| 130 } | 131 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 144 uint32_t arg_count, | 145 uint32_t arg_count, |
| 145 NPVariant *np_result) { | 146 NPVariant *np_result) { |
| 146 NPObjectProxy* proxy = GetProxy(obj); | 147 NPObjectProxy* proxy = GetProxy(obj); |
| 147 if (!proxy) { | 148 if (!proxy) { |
| 148 return obj->_class->invoke(obj, name, args, arg_count, np_result); | 149 return obj->_class->invoke(obj, name, args, arg_count, np_result); |
| 149 } | 150 } |
| 150 | 151 |
| 151 bool result = false; | 152 bool result = false; |
| 152 NPIdentifier_Param name_param; | 153 NPIdentifier_Param name_param; |
| 153 if (is_default) { | 154 if (is_default) { |
| 154 // The data won't actually get used, but set it so we don't send random data
. | 155 // The data won't actually get used, but set it so we don't send random |
| 156 // data. |
| 155 name_param.identifier = NULL; | 157 name_param.identifier = NULL; |
| 156 } else { | 158 } else { |
| 157 CreateNPIdentifierParam(name, &name_param); | 159 CreateNPIdentifierParam(name, &name_param); |
| 158 } | 160 } |
| 159 | 161 |
| 160 // Note: This instance can get destroyed in the context of | 162 // Note: This instance can get destroyed in the context of |
| 161 // Send so addref the channel in this scope. | 163 // Send so addref the channel in this scope. |
| 162 scoped_refptr<PluginChannelBase> channel_copy = proxy->channel_; | 164 scoped_refptr<PluginChannelBase> channel_copy = proxy->channel_; |
| 163 std::vector<NPVariant_Param> args_param; | 165 std::vector<NPVariant_Param> args_param; |
| 164 for (unsigned int i = 0; i < arg_count; ++i) { | 166 for (unsigned int i = 0; i < arg_count; ++i) { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 return; | 392 return; |
| 391 } | 393 } |
| 392 | 394 |
| 393 NPVariant_Param result_param; | 395 NPVariant_Param result_param; |
| 394 std::string message_str(message); | 396 std::string message_str(message); |
| 395 | 397 |
| 396 proxy->Send(new NPObjectMsg_SetException(proxy->route_id(), message_str)); | 398 proxy->Send(new NPObjectMsg_SetException(proxy->route_id(), message_str)); |
| 397 // Send may delete proxy. | 399 // Send may delete proxy. |
| 398 proxy = NULL; | 400 proxy = NULL; |
| 399 } | 401 } |
| 400 | |
| OLD | NEW |