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 "content/plugin/npobject_proxy.h" | 5 #include "content/plugin/npobject_proxy.h" |
6 | 6 |
7 #include "content/common/plugin_messages.h" | 7 #include "content/common/plugin_messages.h" |
8 #include "content/plugin/npobject_util.h" | 8 #include "content/plugin/npobject_util.h" |
9 #include "content/plugin/plugin_channel.h" | 9 #include "content/plugin/plugin_channel.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 : channel_(channel), | 62 : channel_(channel), |
63 route_id_(route_id), | 63 route_id_(route_id), |
64 containing_window_(containing_window), | 64 containing_window_(containing_window), |
65 page_url_(page_url) { | 65 page_url_(page_url) { |
66 channel_->AddRoute(route_id, this, this); | 66 channel_->AddRoute(route_id, this, this); |
67 } | 67 } |
68 | 68 |
69 NPObjectProxy::~NPObjectProxy() { | 69 NPObjectProxy::~NPObjectProxy() { |
70 if (channel_.get()) { | 70 if (channel_.get()) { |
71 Send(new NPObjectMsg_Release(route_id_)); | 71 Send(new NPObjectMsg_Release(route_id_)); |
72 if (channel_.get()) | 72 if (channel_.get()) { |
73 channel_->RemoveRoute(route_id_); | 73 channel_->RemoveRoute(route_id_); |
| 74 channel_->RemoveMappingForNPObjectProxy(route_id_); |
| 75 } |
74 } | 76 } |
75 } | 77 } |
76 | 78 |
77 NPObject* NPObjectProxy::Create(PluginChannelBase* channel, | 79 NPObject* NPObjectProxy::Create(PluginChannelBase* channel, |
78 int route_id, | 80 int route_id, |
79 gfx::NativeViewId containing_window, | 81 gfx::NativeViewId containing_window, |
80 const GURL& page_url) { | 82 const GURL& page_url) { |
81 NPObjectWrapper* obj = reinterpret_cast<NPObjectWrapper*>( | 83 NPObjectWrapper* obj = reinterpret_cast<NPObjectWrapper*>( |
82 WebBindings::createObject(0, &npclass_proxy_)); | 84 WebBindings::createObject(0, &npclass_proxy_)); |
83 obj->proxy = new NPObjectProxy( | 85 obj->proxy = new NPObjectProxy( |
84 channel, route_id, containing_window, page_url); | 86 channel, route_id, containing_window, page_url); |
85 | 87 channel->AddMappingForNPObjectProxy(route_id, &obj->object); |
86 return reinterpret_cast<NPObject*>(obj); | 88 return reinterpret_cast<NPObject*>(obj); |
87 } | 89 } |
88 | 90 |
89 bool NPObjectProxy::Send(IPC::Message* msg) { | 91 bool NPObjectProxy::Send(IPC::Message* msg) { |
90 if (channel_.get()) | 92 if (channel_.get()) |
91 return channel_->Send(msg); | 93 return channel_->Send(msg); |
92 | 94 |
93 delete msg; | 95 delete msg; |
94 return false; | 96 return false; |
95 } | 97 } |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 proxy->Send(msg); | 493 proxy->Send(msg); |
492 // Send may delete proxy. | 494 // Send may delete proxy. |
493 proxy = NULL; | 495 proxy = NULL; |
494 if (!result) | 496 if (!result) |
495 return false; | 497 return false; |
496 | 498 |
497 CreateNPVariant( | 499 CreateNPVariant( |
498 result_param, channel.get(), result_var, containing_window, page_url); | 500 result_param, channel.get(), result_var, containing_window, page_url); |
499 return true; | 501 return true; |
500 } | 502 } |
OLD | NEW |