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_stub.h" | 5 #include "content/child/npobject_stub.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" |
8 #include "content/child/npobject_util.h" | 9 #include "content/child/npobject_util.h" |
9 #include "content/child/plugin_messages.h" | 10 #include "content/child/plugin_messages.h" |
10 #include "content/public/common/content_client.h" | 11 #include "content/public/common/content_client.h" |
11 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
12 #include "third_party/WebKit/public/web/WebBindings.h" | 13 #include "third_party/WebKit/public/web/WebBindings.h" |
13 #include "third_party/npapi/bindings/npapi.h" | 14 #include "third_party/npapi/bindings/npapi.h" |
14 #include "third_party/npapi/bindings/npruntime.h" | 15 #include "third_party/npapi/bindings/npruntime.h" |
15 #include "webkit/plugins/npapi/plugin_host.h" | |
16 | 16 |
17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
19 #include "webkit/plugins/npapi/plugin_constants_win.h" | 19 #include "content/common/plugin_constants_win.h" |
20 #endif | 20 #endif |
21 | 21 |
22 using WebKit::WebBindings; | 22 using WebKit::WebBindings; |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 NPObjectStub::NPObjectStub( | 26 NPObjectStub::NPObjectStub( |
27 NPObject* npobject, | 27 NPObject* npobject, |
28 NPChannelBase* channel, | 28 NPChannelBase* channel, |
29 int route_id, | 29 int route_id, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 if (IsPluginProcess()) { | 257 if (IsPluginProcess()) { |
258 if (npobject_->_class->setProperty) { | 258 if (npobject_->_class->setProperty) { |
259 #if defined(OS_WIN) | 259 #if defined(OS_WIN) |
260 static base::FilePath plugin_path = | 260 static base::FilePath plugin_path = |
261 CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 261 CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
262 switches::kPluginPath); | 262 switches::kPluginPath); |
263 static std::wstring filename = StringToLowerASCII( | 263 static std::wstring filename = StringToLowerASCII( |
264 plugin_path.BaseName().value()); | 264 plugin_path.BaseName().value()); |
265 static NPIdentifier fullscreen = | 265 static NPIdentifier fullscreen = |
266 WebBindings::getStringIdentifier("fullScreen"); | 266 WebBindings::getStringIdentifier("fullScreen"); |
267 if (filename == webkit::npapi::kNewWMPPlugin && id == fullscreen) { | 267 if (filename == kNewWMPPlugin && id == fullscreen) { |
268 // Workaround for bug 15985, which is if Flash causes WMP to go | 268 // Workaround for bug 15985, which is if Flash causes WMP to go |
269 // full screen a deadlock can occur when WMP calls SetFocus. | 269 // full screen a deadlock can occur when WMP calls SetFocus. |
270 NPObjectMsg_SetProperty::WriteReplyParams(reply_msg, true); | 270 NPObjectMsg_SetProperty::WriteReplyParams(reply_msg, true); |
271 Send(reply_msg); | 271 Send(reply_msg); |
272 reply_msg = NULL; | 272 reply_msg = NULL; |
273 } | 273 } |
274 #endif | 274 #endif |
275 result = npobject_->_class->setProperty(npobject_, id, &property_var); | 275 result = npobject_->_class->setProperty(npobject_, id, &property_var); |
276 } else { | 276 } else { |
277 result = false; | 277 result = false; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 if (!*result) | 333 if (!*result) |
334 return; | 334 return; |
335 | 335 |
336 for (unsigned int i = 0; i < count; ++i) { | 336 for (unsigned int i = 0; i < count; ++i) { |
337 NPIdentifier_Param param; | 337 NPIdentifier_Param param; |
338 CreateNPIdentifierParam(value_np[i], ¶m); | 338 CreateNPIdentifierParam(value_np[i], ¶m); |
339 value->push_back(param); | 339 value->push_back(param); |
340 } | 340 } |
341 | 341 |
342 webkit::npapi::PluginHost::Singleton()->host_functions()->memfree(value_np); | 342 PluginHost::Singleton()->host_functions()->memfree(value_np); |
343 } | 343 } |
344 | 344 |
345 void NPObjectStub::OnConstruct(const std::vector<NPVariant_Param>& args, | 345 void NPObjectStub::OnConstruct(const std::vector<NPVariant_Param>& args, |
346 IPC::Message* reply_msg) { | 346 IPC::Message* reply_msg) { |
347 bool return_value = false; | 347 bool return_value = false; |
348 NPVariant_Param result_param; | 348 NPVariant_Param result_param; |
349 NPVariant result_var; | 349 NPVariant result_var; |
350 | 350 |
351 VOID_TO_NPVARIANT(result_var); | 351 VOID_TO_NPVARIANT(result_var); |
352 | 352 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 channel_.get(), | 415 channel_.get(), |
416 &result_param, | 416 &result_param, |
417 true, | 417 true, |
418 render_view_id_, | 418 render_view_id_, |
419 page_url_); | 419 page_url_); |
420 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); | 420 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); |
421 channel_->Send(reply_msg); | 421 channel_->Send(reply_msg); |
422 } | 422 } |
423 | 423 |
424 } // namespace content | 424 } // namespace content |
OLD | NEW |