| 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_proxy.h" | 5 #include "content/common/npobject_proxy.h" |
| 6 | 6 |
| 7 #include "content/common/np_channel_base.h" | 7 #include "content/common/np_channel_base.h" |
| 8 #include "content/common/npobject_util.h" | 8 #include "content/common/npobject_util.h" |
| 9 #include "content/common/plugin_messages.h" | 9 #include "content/common/plugin_messages.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
| 11 #include "webkit/glue/webkit_glue.h" | 11 #include "webkit/glue/webkit_glue.h" |
| 12 #include "webkit/plugins/npapi/plugin_instance.h" | 12 #include "webkit/plugins/npapi/plugin_instance.h" |
| 13 #include "webkit/plugins/npapi/plugin_host.h" |
| 13 | 14 |
| 14 using WebKit::WebBindings; | 15 using WebKit::WebBindings; |
| 15 | 16 |
| 16 struct NPObjectWrapper { | 17 struct NPObjectWrapper { |
| 17 NPObject object; | 18 NPObject object; |
| 18 NPObjectProxy* proxy; | 19 NPObjectProxy* proxy; |
| 19 }; | 20 }; |
| 20 | 21 |
| 21 NPClass NPObjectProxy::npclass_proxy_ = { | 22 NPClass NPObjectProxy::npclass_proxy_ = { |
| 22 NP_CLASS_STRUCT_VERSION, | 23 NP_CLASS_STRUCT_VERSION, |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 proxy->Send(new NPObjectMsg_Enumeration( | 378 proxy->Send(new NPObjectMsg_Enumeration( |
| 378 proxy->route_id(), &value_param, &result)); | 379 proxy->route_id(), &value_param, &result)); |
| 379 // Send may delete proxy. | 380 // Send may delete proxy. |
| 380 proxy = NULL; | 381 proxy = NULL; |
| 381 | 382 |
| 382 if (!result) | 383 if (!result) |
| 383 return false; | 384 return false; |
| 384 | 385 |
| 385 *count = static_cast<unsigned int>(value_param.size()); | 386 *count = static_cast<unsigned int>(value_param.size()); |
| 386 *value = static_cast<NPIdentifier *>( | 387 *value = static_cast<NPIdentifier *>( |
| 387 NPN_MemAlloc(sizeof(NPIdentifier) * *count)); | 388 webkit::npapi::PluginHost::Singleton()->host_functions()->memalloc( |
| 389 sizeof(NPIdentifier) * *count)); |
| 388 for (unsigned int i = 0; i < *count; ++i) | 390 for (unsigned int i = 0; i < *count; ++i) |
| 389 (*value)[i] = CreateNPIdentifier(value_param[i]); | 391 (*value)[i] = CreateNPIdentifier(value_param[i]); |
| 390 | 392 |
| 391 return true; | 393 return true; |
| 392 } | 394 } |
| 393 | 395 |
| 394 bool NPObjectProxy::NPNConstruct(NPObject *obj, | 396 bool NPObjectProxy::NPNConstruct(NPObject *obj, |
| 395 const NPVariant *args, | 397 const NPVariant *args, |
| 396 uint32_t arg_count, | 398 uint32_t arg_count, |
| 397 NPVariant *np_result) { | 399 NPVariant *np_result) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 proxy->Send(msg); | 489 proxy->Send(msg); |
| 488 // Send may delete proxy. | 490 // Send may delete proxy. |
| 489 proxy = NULL; | 491 proxy = NULL; |
| 490 if (!result) | 492 if (!result) |
| 491 return false; | 493 return false; |
| 492 | 494 |
| 493 CreateNPVariant( | 495 CreateNPVariant( |
| 494 result_param, channel.get(), result_var, containing_window, page_url); | 496 result_param, channel.get(), result_var, containing_window, page_url); |
| 495 return true; | 497 return true; |
| 496 } | 498 } |
| OLD | NEW |