| 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_stub.h" | 5 #include "chrome/plugin/npobject_stub.h" |
| 6 | 6 |
| 7 #include "chrome/common/child_process_logging.h" | 7 #include "chrome/common/child_process_logging.h" |
| 8 #include "chrome/common/plugin_messages.h" | 8 #include "chrome/common/plugin_messages.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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 IPC_MESSAGE_HANDLER(NPObjectMsg_HasMethod, OnHasMethod); | 74 IPC_MESSAGE_HANDLER(NPObjectMsg_HasMethod, OnHasMethod); |
| 75 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Invoke, OnInvoke); | 75 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Invoke, OnInvoke); |
| 76 IPC_MESSAGE_HANDLER(NPObjectMsg_HasProperty, OnHasProperty); | 76 IPC_MESSAGE_HANDLER(NPObjectMsg_HasProperty, OnHasProperty); |
| 77 IPC_MESSAGE_HANDLER(NPObjectMsg_GetProperty, OnGetProperty); | 77 IPC_MESSAGE_HANDLER(NPObjectMsg_GetProperty, OnGetProperty); |
| 78 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_SetProperty, OnSetProperty); | 78 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_SetProperty, OnSetProperty); |
| 79 IPC_MESSAGE_HANDLER(NPObjectMsg_RemoveProperty, OnRemoveProperty); | 79 IPC_MESSAGE_HANDLER(NPObjectMsg_RemoveProperty, OnRemoveProperty); |
| 80 IPC_MESSAGE_HANDLER(NPObjectMsg_Invalidate, OnInvalidate); | 80 IPC_MESSAGE_HANDLER(NPObjectMsg_Invalidate, OnInvalidate); |
| 81 IPC_MESSAGE_HANDLER(NPObjectMsg_Enumeration, OnEnumeration); | 81 IPC_MESSAGE_HANDLER(NPObjectMsg_Enumeration, OnEnumeration); |
| 82 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Construct, OnConstruct); | 82 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Construct, OnConstruct); |
| 83 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Evaluate, OnEvaluate); | 83 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Evaluate, OnEvaluate); |
| 84 IPC_MESSAGE_HANDLER(NPObjectMsg_SetException, OnSetException); | |
| 85 IPC_MESSAGE_UNHANDLED_ERROR() | 84 IPC_MESSAGE_UNHANDLED_ERROR() |
| 86 IPC_END_MESSAGE_MAP() | 85 IPC_END_MESSAGE_MAP() |
| 87 } | 86 } |
| 88 | 87 |
| 89 void NPObjectStub::OnChannelError() { | 88 void NPObjectStub::OnChannelError() { |
| 90 // If npobject_ is NULLed out, that means a DeleteSoon is happening. | 89 // If npobject_ is NULLed out, that means a DeleteSoon is happening. |
| 91 if (npobject_) | 90 if (npobject_) |
| 92 delete this; | 91 delete this; |
| 93 } | 92 } |
| 94 | 93 |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 bool return_value = WebBindings::evaluateHelper(0, popups_allowed, npobject_, | 364 bool return_value = WebBindings::evaluateHelper(0, popups_allowed, npobject_, |
| 366 &script_string, &result_var); | 365 &script_string, &result_var); |
| 367 | 366 |
| 368 NPVariant_Param result_param; | 367 NPVariant_Param result_param; |
| 369 CreateNPVariantParam( | 368 CreateNPVariantParam( |
| 370 result_var, local_channel, &result_param, true, containing_window_, | 369 result_var, local_channel, &result_param, true, containing_window_, |
| 371 page_url_); | 370 page_url_); |
| 372 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); | 371 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); |
| 373 local_channel->Send(reply_msg); | 372 local_channel->Send(reply_msg); |
| 374 } | 373 } |
| 375 | |
| 376 void NPObjectStub::OnSetException(const std::string& message) { | |
| 377 if (IsPluginProcess()) { | |
| 378 NOTREACHED() << "Should only be called on NPObjects in the renderer"; | |
| 379 return; | |
| 380 } | |
| 381 | |
| 382 WebBindings::setException(npobject_, message.c_str()); | |
| 383 } | |
| OLD | NEW |