OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/child/npobject_proxy.h" | 5 #include "content/child/npobject_proxy.h" |
6 | 6 |
7 #include "content/child/np_channel_base.h" | 7 #include "content/child/np_channel_base.h" |
| 8 #include "content/child/npapi/plugin_host.h" |
| 9 #include "content/child/npapi/plugin_instance.h" |
8 #include "content/child/npobject_util.h" | 10 #include "content/child/npobject_util.h" |
9 #include "content/child/plugin_messages.h" | 11 #include "content/child/plugin_messages.h" |
10 #include "third_party/WebKit/public/web/WebBindings.h" | 12 #include "third_party/WebKit/public/web/WebBindings.h" |
11 #include "webkit/glue/webkit_glue.h" | |
12 #include "webkit/plugins/npapi/plugin_host.h" | |
13 #include "webkit/plugins/npapi/plugin_instance.h" | |
14 | 13 |
15 using WebKit::WebBindings; | 14 using WebKit::WebBindings; |
16 | 15 |
17 namespace content { | 16 namespace content { |
18 | 17 |
19 struct NPObjectWrapper { | 18 struct NPObjectWrapper { |
20 NPObject object; | 19 NPObject object; |
21 NPObjectProxy* proxy; | 20 NPObjectProxy* proxy; |
22 }; | 21 }; |
23 | 22 |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 proxy->Send(new NPObjectMsg_Enumeration( | 382 proxy->Send(new NPObjectMsg_Enumeration( |
384 proxy->route_id(), &value_param, &result)); | 383 proxy->route_id(), &value_param, &result)); |
385 // Send may delete proxy. | 384 // Send may delete proxy. |
386 proxy = NULL; | 385 proxy = NULL; |
387 | 386 |
388 if (!result) | 387 if (!result) |
389 return false; | 388 return false; |
390 | 389 |
391 *count = static_cast<unsigned int>(value_param.size()); | 390 *count = static_cast<unsigned int>(value_param.size()); |
392 *value = static_cast<NPIdentifier *>( | 391 *value = static_cast<NPIdentifier *>( |
393 webkit::npapi::PluginHost::Singleton()->host_functions()->memalloc( | 392 PluginHost::Singleton()->host_functions()->memalloc( |
394 sizeof(NPIdentifier) * *count)); | 393 sizeof(NPIdentifier) * *count)); |
395 for (unsigned int i = 0; i < *count; ++i) | 394 for (unsigned int i = 0; i < *count; ++i) |
396 (*value)[i] = CreateNPIdentifier(value_param[i]); | 395 (*value)[i] = CreateNPIdentifier(value_param[i]); |
397 | 396 |
398 return true; | 397 return true; |
399 } | 398 } |
400 | 399 |
401 bool NPObjectProxy::NPNConstruct(NPObject *obj, | 400 bool NPObjectProxy::NPNConstruct(NPObject *obj, |
402 const NPVariant *args, | 401 const NPVariant *args, |
403 uint32_t arg_count, | 402 uint32_t arg_count, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 NPObjectProxy* proxy = GetProxy(obj); | 462 NPObjectProxy* proxy = GetProxy(obj); |
464 if (!proxy) { | 463 if (!proxy) { |
465 return false; | 464 return false; |
466 } | 465 } |
467 | 466 |
468 bool result = false; | 467 bool result = false; |
469 int render_view_id = proxy->render_view_id_; | 468 int render_view_id = proxy->render_view_id_; |
470 bool popups_allowed = false; | 469 bool popups_allowed = false; |
471 | 470 |
472 if (npp) { | 471 if (npp) { |
473 webkit::npapi::PluginInstance* plugin_instance = | 472 PluginInstance* plugin_instance = |
474 reinterpret_cast<webkit::npapi::PluginInstance*>(npp->ndata); | 473 reinterpret_cast<PluginInstance*>(npp->ndata); |
475 if (plugin_instance) | 474 if (plugin_instance) |
476 popups_allowed = plugin_instance->popups_allowed(); | 475 popups_allowed = plugin_instance->popups_allowed(); |
477 } | 476 } |
478 | 477 |
479 NPVariant_Param result_param; | 478 NPVariant_Param result_param; |
480 std::string script_str = std::string( | 479 std::string script_str = std::string( |
481 script->UTF8Characters, script->UTF8Length); | 480 script->UTF8Characters, script->UTF8Length); |
482 | 481 |
483 NPObjectMsg_Evaluate* msg = new NPObjectMsg_Evaluate(proxy->route_id(), | 482 NPObjectMsg_Evaluate* msg = new NPObjectMsg_Evaluate(proxy->route_id(), |
484 script_str, | 483 script_str, |
(...skipping 14 matching lines...) Expand all Loading... |
499 proxy = NULL; | 498 proxy = NULL; |
500 if (!result) | 499 if (!result) |
501 return false; | 500 return false; |
502 | 501 |
503 CreateNPVariant( | 502 CreateNPVariant( |
504 result_param, channel.get(), result_var, render_view_id, page_url); | 503 result_param, channel.get(), result_var, render_view_id, page_url); |
505 return true; | 504 return true; |
506 } | 505 } |
507 | 506 |
508 } // namespace content | 507 } // namespace content |
OLD | NEW |