OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/npobject_stub.h" | 5 #include "content/common/npobject_stub.h" |
6 | 6 |
| 7 #include "base/command_line.h" |
7 #include "content/common/content_client.h" | 8 #include "content/common/content_client.h" |
| 9 #include "content/common/content_switches.h" |
| 10 #include "content/common/np_channel_base.h" |
8 #include "content/common/npobject_util.h" | 11 #include "content/common/npobject_util.h" |
9 #include "content/common/plugin_messages.h" | 12 #include "content/common/plugin_messages.h" |
10 #include "content/plugin/plugin_thread.h" | |
11 #include "third_party/npapi/bindings/npapi.h" | 13 #include "third_party/npapi/bindings/npapi.h" |
12 #include "third_party/npapi/bindings/npruntime.h" | 14 #include "third_party/npapi/bindings/npruntime.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
14 #include "webkit/plugins/npapi/plugin_constants_win.h" | 16 #include "webkit/plugins/npapi/plugin_constants_win.h" |
15 | 17 |
16 class NPChannelBase; | |
17 | |
18 using WebKit::WebBindings; | 18 using WebKit::WebBindings; |
19 | 19 |
20 NPObjectStub::NPObjectStub( | 20 NPObjectStub::NPObjectStub( |
21 NPObject* npobject, | 21 NPObject* npobject, |
22 NPChannelBase* channel, | 22 NPChannelBase* channel, |
23 int route_id, | 23 int route_id, |
24 gfx::NativeViewId containing_window, | 24 gfx::NativeViewId containing_window, |
25 const GURL& page_url) | 25 const GURL& page_url) |
26 : npobject_(npobject), | 26 : npobject_(npobject), |
27 channel_(channel), | 27 channel_(channel), |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 if (!CreateNPVariant( | 235 if (!CreateNPVariant( |
236 property, channel_, &property_var, containing_window_, page_url_)) { | 236 property, channel_, &property_var, containing_window_, page_url_)) { |
237 NPObjectMsg_SetProperty::WriteReplyParams(reply_msg, result); | 237 NPObjectMsg_SetProperty::WriteReplyParams(reply_msg, result); |
238 channel_->Send(reply_msg); | 238 channel_->Send(reply_msg); |
239 return; | 239 return; |
240 } | 240 } |
241 | 241 |
242 if (IsPluginProcess()) { | 242 if (IsPluginProcess()) { |
243 if (npobject_->_class->setProperty) { | 243 if (npobject_->_class->setProperty) { |
244 #if defined(OS_WIN) | 244 #if defined(OS_WIN) |
| 245 static FilePath plugin_path = |
| 246 CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| 247 switches::kPluginPath); |
245 static std::wstring filename = StringToLowerASCII( | 248 static std::wstring filename = StringToLowerASCII( |
246 PluginThread::current()->plugin_path().BaseName().value()); | 249 plugin_path.BaseName().value()); |
247 static NPIdentifier fullscreen = | 250 static NPIdentifier fullscreen = |
248 WebBindings::getStringIdentifier("fullScreen"); | 251 WebBindings::getStringIdentifier("fullScreen"); |
249 if (filename == webkit::npapi::kNewWMPPlugin && id == fullscreen) { | 252 if (filename == webkit::npapi::kNewWMPPlugin && id == fullscreen) { |
250 // Workaround for bug 15985, which is if Flash causes WMP to go | 253 // Workaround for bug 15985, which is if Flash causes WMP to go |
251 // full screen a deadlock can occur when WMP calls SetFocus. | 254 // full screen a deadlock can occur when WMP calls SetFocus. |
252 NPObjectMsg_SetProperty::WriteReplyParams(reply_msg, true); | 255 NPObjectMsg_SetProperty::WriteReplyParams(reply_msg, true); |
253 Send(reply_msg); | 256 Send(reply_msg); |
254 reply_msg = NULL; | 257 reply_msg = NULL; |
255 } | 258 } |
256 #endif | 259 #endif |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 388 |
386 bool return_value = WebBindings::evaluateHelper(0, popups_allowed, npobject_, | 389 bool return_value = WebBindings::evaluateHelper(0, popups_allowed, npobject_, |
387 &script_string, &result_var); | 390 &script_string, &result_var); |
388 | 391 |
389 NPVariant_Param result_param; | 392 NPVariant_Param result_param; |
390 CreateNPVariantParam( | 393 CreateNPVariantParam( |
391 result_var, channel_, &result_param, true, containing_window_, page_url_); | 394 result_var, channel_, &result_param, true, containing_window_, page_url_); |
392 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); | 395 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); |
393 channel_->Send(reply_msg); | 396 channel_->Send(reply_msg); |
394 } | 397 } |
OLD | NEW |