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 // A class that receives IPC messages from an NPObjectProxy and calls the real | 5 // A class that receives IPC messages from an NPObjectProxy and calls the real |
6 // NPObject. | 6 // NPObject. |
7 | 7 |
8 #ifndef CHROME_PLUGIN_NPOBJECT_STUB_H_ | 8 #ifndef CHROME_PLUGIN_NPOBJECT_STUB_H_ |
9 #define CHROME_PLUGIN_NPOBJECT_STUB_H_ | 9 #define CHROME_PLUGIN_NPOBJECT_STUB_H_ |
10 | 10 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
14 #include "chrome/common/ipc_channel.h" | 14 #include "chrome/common/ipc_channel.h" |
| 15 #include "googleurl/src/gurl.h" |
15 | 16 |
16 namespace base { | 17 namespace base { |
17 class WaitableEvent; | 18 class WaitableEvent; |
18 } | 19 } |
19 | 20 |
20 class PluginChannelBase; | 21 class PluginChannelBase; |
21 class WebPluginDelegateProxy; | 22 class WebPluginDelegateProxy; |
22 struct NPIdentifier_Param; | 23 struct NPIdentifier_Param; |
23 struct NPObject; | 24 struct NPObject; |
24 struct NPVariant_Param; | 25 struct NPVariant_Param; |
25 | 26 |
26 // This wraps an NPObject and converts IPC messages from NPObjectProxy to calls | 27 // This wraps an NPObject and converts IPC messages from NPObjectProxy to calls |
27 // to the object. The results are marshalled back. See npobject_proxy.h for | 28 // to the object. The results are marshalled back. See npobject_proxy.h for |
28 // more information. | 29 // more information. |
29 class NPObjectStub : public IPC::Channel::Listener, | 30 class NPObjectStub : public IPC::Channel::Listener, |
30 public IPC::Message::Sender { | 31 public IPC::Message::Sender { |
31 public: | 32 public: |
32 NPObjectStub(NPObject* npobject, | 33 NPObjectStub(NPObject* npobject, |
33 PluginChannelBase* channel, | 34 PluginChannelBase* channel, |
34 int route_id, | 35 int route_id, |
35 base::WaitableEvent* modal_dialog_event); | 36 base::WaitableEvent* modal_dialog_event, |
| 37 const GURL& page_url); |
36 ~NPObjectStub(); | 38 ~NPObjectStub(); |
37 | 39 |
38 // IPC::Message::Sender implementation: | 40 // IPC::Message::Sender implementation: |
39 bool Send(IPC::Message* msg); | 41 bool Send(IPC::Message* msg); |
40 | 42 |
41 // Called when the plugin widget that this NPObject came from is destroyed. | 43 // Called when the plugin widget that this NPObject came from is destroyed. |
42 // This is needed because the renderer calls NPN_DeallocateObject on the | 44 // This is needed because the renderer calls NPN_DeallocateObject on the |
43 // window script object on destruction to avoid leaks. | 45 // window script object on destruction to avoid leaks. |
44 void set_invalid() { valid_ = false; } | 46 void set_invalid() { valid_ = false; } |
45 void set_proxy(WebPluginDelegateProxy* proxy) { | 47 void set_proxy(WebPluginDelegateProxy* proxy) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 scoped_refptr<PluginChannelBase> channel_; | 85 scoped_refptr<PluginChannelBase> channel_; |
84 int route_id_; | 86 int route_id_; |
85 | 87 |
86 // These variables are used to ensure that the window script object is not | 88 // These variables are used to ensure that the window script object is not |
87 // called after the plugin widget has gone away, as the frame manually | 89 // called after the plugin widget has gone away, as the frame manually |
88 // deallocates it and ignores the refcount to avoid leaks. | 90 // deallocates it and ignores the refcount to avoid leaks. |
89 bool valid_; | 91 bool valid_; |
90 WebPluginDelegateProxy* web_plugin_delegate_proxy_; | 92 WebPluginDelegateProxy* web_plugin_delegate_proxy_; |
91 | 93 |
92 base::WaitableEvent* modal_dialog_event_; | 94 base::WaitableEvent* modal_dialog_event_; |
| 95 |
| 96 // The url of the main frame hosting the plugin. |
| 97 GURL page_url_; |
93 }; | 98 }; |
94 | 99 |
95 #endif // CHROME_PLUGIN_NPOBJECT_STUB_H_ | 100 #endif // CHROME_PLUGIN_NPOBJECT_STUB_H_ |
OLD | NEW |