| 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 | 15 |
| 16 namespace base { |
| 17 class WaitableEvent; |
| 18 } |
| 19 |
| 16 class PluginChannelBase; | 20 class PluginChannelBase; |
| 17 class WebPluginDelegateProxy; | 21 class WebPluginDelegateProxy; |
| 18 struct NPIdentifier_Param; | 22 struct NPIdentifier_Param; |
| 19 struct NPObject; | 23 struct NPObject; |
| 20 struct NPVariant_Param; | 24 struct NPVariant_Param; |
| 21 | 25 |
| 22 // This wraps an NPObject and converts IPC messages from NPObjectProxy to calls | 26 // This wraps an NPObject and converts IPC messages from NPObjectProxy to calls |
| 23 // to the object. The results are marshalled back. See npobject_proxy.h for | 27 // to the object. The results are marshalled back. See npobject_proxy.h for |
| 24 // more information. | 28 // more information. |
| 25 class NPObjectStub : public IPC::Channel::Listener, | 29 class NPObjectStub : public IPC::Channel::Listener, |
| 26 public IPC::Message::Sender { | 30 public IPC::Message::Sender { |
| 27 public: | 31 public: |
| 28 NPObjectStub(NPObject* npobject, PluginChannelBase* channel, int route_id); | 32 NPObjectStub(NPObject* npobject, |
| 33 PluginChannelBase* channel, |
| 34 int route_id, |
| 35 base::WaitableEvent* modal_dialog_event); |
| 29 ~NPObjectStub(); | 36 ~NPObjectStub(); |
| 30 | 37 |
| 31 // IPC::Message::Sender implementation: | 38 // IPC::Message::Sender implementation: |
| 32 bool Send(IPC::Message* msg); | 39 bool Send(IPC::Message* msg); |
| 33 | 40 |
| 34 // Called when the plugin widget that this NPObject came from is destroyed. | 41 // Called when the plugin widget that this NPObject came from is destroyed. |
| 35 // This is needed because the renderer calls NPN_DeallocateObject on the | 42 // This is needed because the renderer calls NPN_DeallocateObject on the |
| 36 // window script object on destruction to avoid leaks. | 43 // window script object on destruction to avoid leaks. |
| 37 void set_invalid() { valid_ = false; } | 44 void set_invalid() { valid_ = false; } |
| 38 void set_proxy(WebPluginDelegateProxy* proxy) { | 45 void set_proxy(WebPluginDelegateProxy* proxy) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 67 bool* result); | 74 bool* result); |
| 68 void OnEvaluate(const std::string& script, bool popups_allowed, | 75 void OnEvaluate(const std::string& script, bool popups_allowed, |
| 69 IPC::Message* reply_msg); | 76 IPC::Message* reply_msg); |
| 70 void OnSetException(const std::string& message); | 77 void OnSetException(const std::string& message); |
| 71 | 78 |
| 72 private: | 79 private: |
| 73 NPObject* npobject_; | 80 NPObject* npobject_; |
| 74 int route_id_; | 81 int route_id_; |
| 75 scoped_refptr<PluginChannelBase> channel_; | 82 scoped_refptr<PluginChannelBase> channel_; |
| 76 | 83 |
| 84 base::WaitableEvent* modal_dialog_event_; |
| 85 |
| 77 // These variables are used to ensure that the window script object is not | 86 // These variables are used to ensure that the window script object is not |
| 78 // called after the plugin widget has gone away, as the frame manually | 87 // called after the plugin widget has gone away, as the frame manually |
| 79 // deallocates it and ignores the refcount to avoid leaks. | 88 // deallocates it and ignores the refcount to avoid leaks. |
| 80 bool valid_; | 89 bool valid_; |
| 81 WebPluginDelegateProxy* web_plugin_delegate_proxy_; | 90 WebPluginDelegateProxy* web_plugin_delegate_proxy_; |
| 82 }; | 91 }; |
| 83 | 92 |
| 84 #endif // CHROME_PLUGIN_NPOBJECT_STUB_H_ | 93 #endif // CHROME_PLUGIN_NPOBJECT_STUB_H_ |
| OLD | NEW |