| 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 "content/common/np_channel_base.h" | 7 #include "content/common/np_channel_base.h" |
| 8 #include "content/common/npobject_util.h" | 8 #include "content/common/npobject_util.h" |
| 9 #include "content/common/plugin_messages.h" | 9 #include "content/common/plugin_messages.h" |
| 10 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
| 11 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
| 12 #include "third_party/npapi/bindings/npapi.h" | 12 #include "third_party/npapi/bindings/npapi.h" |
| 13 #include "third_party/npapi/bindings/npruntime.h" | 13 #include "third_party/npapi/bindings/npruntime.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
| 15 #include "webkit/plugins/npapi/plugin_host.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 "webkit/plugins/npapi/plugin_constants_win.h" |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 using WebKit::WebBindings; | 22 using WebKit::WebBindings; |
| 23 | 23 |
| 24 namespace content { |
| 25 |
| 24 NPObjectStub::NPObjectStub( | 26 NPObjectStub::NPObjectStub( |
| 25 NPObject* npobject, | 27 NPObject* npobject, |
| 26 NPChannelBase* channel, | 28 NPChannelBase* channel, |
| 27 int route_id, | 29 int route_id, |
| 28 gfx::NativeViewId containing_window, | 30 gfx::NativeViewId containing_window, |
| 29 const GURL& page_url) | 31 const GURL& page_url) |
| 30 : npobject_(npobject), | 32 : npobject_(npobject), |
| 31 channel_(channel), | 33 channel_(channel), |
| 32 route_id_(route_id), | 34 route_id_(route_id), |
| 33 containing_window_(containing_window), | 35 containing_window_(containing_window), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 | 68 |
| 67 NPObject* NPObjectStub::GetUnderlyingNPObject() { | 69 NPObject* NPObjectStub::GetUnderlyingNPObject() { |
| 68 return npobject_; | 70 return npobject_; |
| 69 } | 71 } |
| 70 | 72 |
| 71 IPC::Listener* NPObjectStub::GetChannelListener() { | 73 IPC::Listener* NPObjectStub::GetChannelListener() { |
| 72 return static_cast<IPC::Listener*>(this); | 74 return static_cast<IPC::Listener*>(this); |
| 73 } | 75 } |
| 74 | 76 |
| 75 bool NPObjectStub::OnMessageReceived(const IPC::Message& msg) { | 77 bool NPObjectStub::OnMessageReceived(const IPC::Message& msg) { |
| 76 content::GetContentClient()->SetActiveURL(page_url_); | 78 GetContentClient()->SetActiveURL(page_url_); |
| 77 if (!npobject_) { | 79 if (!npobject_) { |
| 78 if (msg.is_sync()) { | 80 if (msg.is_sync()) { |
| 79 // The object could be garbage because the frame has gone away, so | 81 // The object could be garbage because the frame has gone away, so |
| 80 // just send an error reply to the caller. | 82 // just send an error reply to the caller. |
| 81 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); | 83 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); |
| 82 reply->set_reply_error(); | 84 reply->set_reply_error(); |
| 83 Send(reply); | 85 Send(reply); |
| 84 } | 86 } |
| 85 | 87 |
| 86 return true; | 88 return true; |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 396 |
| 395 bool return_value = WebBindings::evaluateHelper(0, popups_allowed, npobject_, | 397 bool return_value = WebBindings::evaluateHelper(0, popups_allowed, npobject_, |
| 396 &script_string, &result_var); | 398 &script_string, &result_var); |
| 397 | 399 |
| 398 NPVariant_Param result_param; | 400 NPVariant_Param result_param; |
| 399 CreateNPVariantParam( | 401 CreateNPVariantParam( |
| 400 result_var, channel_, &result_param, true, containing_window_, page_url_); | 402 result_var, channel_, &result_param, true, containing_window_, page_url_); |
| 401 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); | 403 NPObjectMsg_Evaluate::WriteReplyParams(reply_msg, result_param, return_value); |
| 402 channel_->Send(reply_msg); | 404 channel_->Send(reply_msg); |
| 403 } | 405 } |
| 406 |
| 407 } // namespace content |
| OLD | NEW |