| 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 "chrome/common/plugin_messages.h" | 7 #include "chrome/common/plugin_messages.h" |
| 8 #include "chrome/common/win_util.h" | 8 #include "chrome/common/win_util.h" |
| 9 #include "chrome/plugin/npobject_util.h" | 9 #include "chrome/plugin/npobject_util.h" |
| 10 #include "chrome/plugin/plugin_channel_base.h" | 10 #include "chrome/plugin/plugin_channel_base.h" |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 bool NPObjectProxy::NPNEvaluate(NPP npp, | 317 bool NPObjectProxy::NPNEvaluate(NPP npp, |
| 318 NPObject *obj, | 318 NPObject *obj, |
| 319 NPString *script, | 319 NPString *script, |
| 320 NPVariant *result_var) { | 320 NPVariant *result_var) { |
| 321 bool result = false; | 321 bool result = false; |
| 322 NPObjectProxy* proxy = GetProxy(obj); | 322 NPObjectProxy* proxy = GetProxy(obj); |
| 323 if (!proxy) { | 323 if (!proxy) { |
| 324 return false; | 324 return false; |
| 325 } | 325 } |
| 326 | 326 |
| 327 bool popups_allowed = false; |
| 328 |
| 329 if (npp) { |
| 330 NPAPI::PluginInstance* plugin_instance = |
| 331 reinterpret_cast<NPAPI::PluginInstance*>(npp->ndata); |
| 332 if (plugin_instance) |
| 333 popups_allowed = plugin_instance->popups_allowed(); |
| 334 } |
| 335 |
| 327 NPVariant_Param result_param; | 336 NPVariant_Param result_param; |
| 328 std::string script_str = std::string( | 337 std::string script_str = std::string( |
| 329 script->UTF8Characters, script->UTF8Length); | 338 script->UTF8Characters, script->UTF8Length); |
| 330 | 339 |
| 331 NPObjectMsg_Evaluate* msg = new NPObjectMsg_Evaluate(proxy->route_id(), | 340 NPObjectMsg_Evaluate* msg = new NPObjectMsg_Evaluate(proxy->route_id(), |
| 332 script_str, | 341 script_str, |
| 342 popups_allowed, |
| 333 &result_param, | 343 &result_param, |
| 334 &result); | 344 &result); |
| 335 | 345 |
| 336 // Please refer to the comments in NPObjectProxy::NPInvokePrivate for | 346 // Please refer to the comments in NPObjectProxy::NPInvokePrivate for |
| 337 // the reasoning behind setting the pump messages event in the sync message. | 347 // the reasoning behind setting the pump messages event in the sync message. |
| 338 msg->set_pump_messages_event(proxy->modal_dialog_event_); | 348 msg->set_pump_messages_event(proxy->modal_dialog_event_); |
| 339 proxy->Send(msg); | 349 proxy->Send(msg); |
| 340 if (!result) | 350 if (!result) |
| 341 return false; | 351 return false; |
| 342 | 352 |
| 343 CreateNPVariant( | 353 CreateNPVariant( |
| 344 result_param, proxy->channel(), result_var, proxy->modal_dialog_event_); | 354 result_param, proxy->channel(), result_var, proxy->modal_dialog_event_); |
| 345 return true; | 355 return true; |
| 346 } | 356 } |
| 347 | 357 |
| 348 void NPObjectProxy::NPNSetException(NPObject *obj, | 358 void NPObjectProxy::NPNSetException(NPObject *obj, |
| 349 const NPUTF8 *message) { | 359 const NPUTF8 *message) { |
| 350 NPObjectProxy* proxy = GetProxy(obj); | 360 NPObjectProxy* proxy = GetProxy(obj); |
| 351 if (!proxy) { | 361 if (!proxy) { |
| 352 return; | 362 return; |
| 353 } | 363 } |
| 354 | 364 |
| 355 NPVariant_Param result_param; | 365 NPVariant_Param result_param; |
| 356 std::string message_str(message); | 366 std::string message_str(message); |
| 357 | 367 |
| 358 proxy->Send(new NPObjectMsg_SetException(proxy->route_id(), message_str)); | 368 proxy->Send(new NPObjectMsg_SetException(proxy->route_id(), message_str)); |
| 359 } | 369 } |
| 360 | 370 |
| OLD | NEW |