| 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" |
| 11 #include "chrome/plugin/plugin_thread.h" |
| 11 #include "chrome/renderer/webplugin_delegate_proxy.h" | 12 #include "chrome/renderer/webplugin_delegate_proxy.h" |
| 12 #include "third_party/npapi/bindings/npapi.h" | 13 #include "third_party/npapi/bindings/npapi.h" |
| 13 #include "third_party/npapi/bindings/npruntime.h" | 14 #include "third_party/npapi/bindings/npruntime.h" |
| 14 #include "webkit/api/public/WebBindings.h" | 15 #include "webkit/api/public/WebBindings.h" |
| 16 #include "webkit/glue/plugins/plugin_constants_win.h" |
| 15 | 17 |
| 16 using WebKit::WebBindings; | 18 using WebKit::WebBindings; |
| 17 | 19 |
| 18 NPObjectStub::NPObjectStub( | 20 NPObjectStub::NPObjectStub( |
| 19 NPObject* npobject, | 21 NPObject* npobject, |
| 20 PluginChannelBase* channel, | 22 PluginChannelBase* channel, |
| 21 int route_id, | 23 int route_id, |
| 22 base::WaitableEvent* modal_dialog_event, | 24 base::WaitableEvent* modal_dialog_event, |
| 23 const GURL& page_url) | 25 const GURL& page_url) |
| 24 : npobject_(npobject), | 26 : npobject_(npobject), |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 63 |
| 62 return; | 64 return; |
| 63 } | 65 } |
| 64 | 66 |
| 65 IPC_BEGIN_MESSAGE_MAP(NPObjectStub, msg) | 67 IPC_BEGIN_MESSAGE_MAP(NPObjectStub, msg) |
| 66 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Release, OnRelease); | 68 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Release, OnRelease); |
| 67 IPC_MESSAGE_HANDLER(NPObjectMsg_HasMethod, OnHasMethod); | 69 IPC_MESSAGE_HANDLER(NPObjectMsg_HasMethod, OnHasMethod); |
| 68 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Invoke, OnInvoke); | 70 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Invoke, OnInvoke); |
| 69 IPC_MESSAGE_HANDLER(NPObjectMsg_HasProperty, OnHasProperty); | 71 IPC_MESSAGE_HANDLER(NPObjectMsg_HasProperty, OnHasProperty); |
| 70 IPC_MESSAGE_HANDLER(NPObjectMsg_GetProperty, OnGetProperty); | 72 IPC_MESSAGE_HANDLER(NPObjectMsg_GetProperty, OnGetProperty); |
| 71 IPC_MESSAGE_HANDLER(NPObjectMsg_SetProperty, OnSetProperty); | 73 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_SetProperty, OnSetProperty); |
| 72 IPC_MESSAGE_HANDLER(NPObjectMsg_RemoveProperty, OnRemoveProperty); | 74 IPC_MESSAGE_HANDLER(NPObjectMsg_RemoveProperty, OnRemoveProperty); |
| 73 IPC_MESSAGE_HANDLER(NPObjectMsg_Invalidate, OnInvalidate); | 75 IPC_MESSAGE_HANDLER(NPObjectMsg_Invalidate, OnInvalidate); |
| 74 IPC_MESSAGE_HANDLER(NPObjectMsg_Enumeration, OnEnumeration); | 76 IPC_MESSAGE_HANDLER(NPObjectMsg_Enumeration, OnEnumeration); |
| 75 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Construct, OnConstruct); | 77 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Construct, OnConstruct); |
| 76 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Evaluate, OnEvaluate); | 78 IPC_MESSAGE_HANDLER_DELAY_REPLY(NPObjectMsg_Evaluate, OnEvaluate); |
| 77 IPC_MESSAGE_HANDLER(NPObjectMsg_SetException, OnSetException); | 79 IPC_MESSAGE_HANDLER(NPObjectMsg_SetException, OnSetException); |
| 78 IPC_MESSAGE_UNHANDLED_ERROR() | 80 IPC_MESSAGE_UNHANDLED_ERROR() |
| 79 IPC_END_MESSAGE_MAP() | 81 IPC_END_MESSAGE_MAP() |
| 80 } | 82 } |
| 81 | 83 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } else { | 200 } else { |
| 199 *result = WebBindings::getProperty(0, npobject_, id, &result_var); | 201 *result = WebBindings::getProperty(0, npobject_, id, &result_var); |
| 200 } | 202 } |
| 201 | 203 |
| 202 CreateNPVariantParam( | 204 CreateNPVariantParam( |
| 203 result_var, channel_, property, true, modal_dialog_event_, page_url_); | 205 result_var, channel_, property, true, modal_dialog_event_, page_url_); |
| 204 } | 206 } |
| 205 | 207 |
| 206 void NPObjectStub::OnSetProperty(const NPIdentifier_Param& name, | 208 void NPObjectStub::OnSetProperty(const NPIdentifier_Param& name, |
| 207 const NPVariant_Param& property, | 209 const NPVariant_Param& property, |
| 208 bool* result) { | 210 IPC::Message* reply_msg) { |
| 211 bool result; |
| 209 NPVariant result_var; | 212 NPVariant result_var; |
| 210 VOID_TO_NPVARIANT(result_var); | 213 VOID_TO_NPVARIANT(result_var); |
| 211 NPIdentifier id = CreateNPIdentifier(name); | 214 NPIdentifier id = CreateNPIdentifier(name); |
| 212 NPVariant property_var; | 215 NPVariant property_var; |
| 213 CreateNPVariant( | 216 CreateNPVariant( |
| 214 property, channel_, &property_var, modal_dialog_event_, page_url_); | 217 property, channel_, &property_var, modal_dialog_event_, page_url_); |
| 215 | 218 |
| 216 if (IsPluginProcess()) { | 219 if (IsPluginProcess()) { |
| 217 if (npobject_->_class->setProperty) { | 220 if (npobject_->_class->setProperty) { |
| 218 *result = npobject_->_class->setProperty(npobject_, id, &property_var); | 221 #if defined(OS_WIN) |
| 222 static std::wstring filename = StringToLowerASCII( |
| 223 PluginThread::current()->plugin_path().BaseName().value()); |
| 224 static NPIdentifier fullscreen = |
| 225 WebBindings::getStringIdentifier("fullScreen"); |
| 226 if (filename == kNewWMPPlugin && id == fullscreen) { |
| 227 // Workaround for bug 15985, which is if Flash causes WMP to go |
| 228 // full screen a deadlock can occur when WMP calls SetFocus. |
| 229 NPObjectMsg_SetProperty::WriteReplyParams(reply_msg, true); |
| 230 Send(reply_msg); |
| 231 reply_msg = NULL; |
| 232 } |
| 233 #endif |
| 234 result = npobject_->_class->setProperty(npobject_, id, &property_var); |
| 219 } else { | 235 } else { |
| 220 *result = false; | 236 result = false; |
| 221 } | 237 } |
| 222 } else { | 238 } else { |
| 223 *result = WebBindings::setProperty(0, npobject_, id, &property_var); | 239 result = WebBindings::setProperty(0, npobject_, id, &property_var); |
| 224 } | 240 } |
| 225 | 241 |
| 226 WebBindings::releaseVariantValue(&property_var); | 242 WebBindings::releaseVariantValue(&property_var); |
| 243 |
| 244 if (reply_msg) { |
| 245 NPObjectMsg_SetProperty::WriteReplyParams(reply_msg, result); |
| 246 Send(reply_msg); |
| 247 } |
| 227 } | 248 } |
| 228 | 249 |
| 229 void NPObjectStub::OnRemoveProperty(const NPIdentifier_Param& name, | 250 void NPObjectStub::OnRemoveProperty(const NPIdentifier_Param& name, |
| 230 bool* result) { | 251 bool* result) { |
| 231 NPIdentifier id = CreateNPIdentifier(name); | 252 NPIdentifier id = CreateNPIdentifier(name); |
| 232 if (IsPluginProcess()) { | 253 if (IsPluginProcess()) { |
| 233 if (npobject_->_class->removeProperty) { | 254 if (npobject_->_class->removeProperty) { |
| 234 *result = npobject_->_class->removeProperty(npobject_, id); | 255 *result = npobject_->_class->removeProperty(npobject_, id); |
| 235 } else { | 256 } else { |
| 236 *result = false; | 257 *result = false; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 } | 371 } |
| 351 | 372 |
| 352 void NPObjectStub::OnSetException(const std::string& message) { | 373 void NPObjectStub::OnSetException(const std::string& message) { |
| 353 if (IsPluginProcess()) { | 374 if (IsPluginProcess()) { |
| 354 NOTREACHED() << "Should only be called on NPObjects in the renderer"; | 375 NOTREACHED() << "Should only be called on NPObjects in the renderer"; |
| 355 return; | 376 return; |
| 356 } | 377 } |
| 357 | 378 |
| 358 WebBindings::setException(npobject_, message.c_str()); | 379 WebBindings::setException(npobject_, message.c_str()); |
| 359 } | 380 } |
| OLD | NEW |