| 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 #pragma once | 10 #pragma once |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 public NPObjectBase { | 32 public NPObjectBase { |
| 33 public: | 33 public: |
| 34 NPObjectStub(NPObject* npobject, | 34 NPObjectStub(NPObject* npobject, |
| 35 PluginChannelBase* channel, | 35 PluginChannelBase* channel, |
| 36 int route_id, | 36 int route_id, |
| 37 gfx::NativeViewId containing_window, | 37 gfx::NativeViewId containing_window, |
| 38 const GURL& page_url); | 38 const GURL& page_url); |
| 39 ~NPObjectStub(); | 39 ~NPObjectStub(); |
| 40 | 40 |
| 41 // IPC::Message::Sender implementation: | 41 // IPC::Message::Sender implementation: |
| 42 bool Send(IPC::Message* msg); | 42 virtual bool Send(IPC::Message* msg); |
| 43 | 43 |
| 44 // Called when the plugin widget that this NPObject came from is destroyed. | 44 // Called when the plugin widget that this NPObject came from is destroyed. |
| 45 // This is needed because the renderer calls NPN_DeallocateObject on the | 45 // This is needed because the renderer calls NPN_DeallocateObject on the |
| 46 // window script object on destruction to avoid leaks. | 46 // window script object on destruction to avoid leaks. |
| 47 void OnPluginDestroyed(); | 47 void OnPluginDestroyed(); |
| 48 | 48 |
| 49 // NPObjectBase implementation. | 49 // NPObjectBase implementation. |
| 50 virtual NPObject* GetUnderlyingNPObject() { | 50 virtual NPObject* GetUnderlyingNPObject(); |
| 51 return npobject_; | |
| 52 } | |
| 53 | 51 |
| 54 IPC::Channel::Listener* GetChannelListener() { | 52 virtual IPC::Channel::Listener* GetChannelListener(); |
| 55 return static_cast<IPC::Channel::Listener*>(this); | |
| 56 } | |
| 57 | 53 |
| 58 private: | 54 private: |
| 59 // IPC::Channel::Listener implementation: | 55 // IPC::Channel::Listener implementation: |
| 60 void OnMessageReceived(const IPC::Message& message); | 56 virtual void OnMessageReceived(const IPC::Message& message); |
| 61 void OnChannelError(); | 57 virtual void OnChannelError(); |
| 62 | 58 |
| 63 // message handlers | 59 // message handlers |
| 64 void OnRelease(IPC::Message* reply_msg); | 60 void OnRelease(IPC::Message* reply_msg); |
| 65 void OnHasMethod(const NPIdentifier_Param& name, | 61 void OnHasMethod(const NPIdentifier_Param& name, |
| 66 bool* result); | 62 bool* result); |
| 67 void OnInvoke(bool is_default, | 63 void OnInvoke(bool is_default, |
| 68 const NPIdentifier_Param& method, | 64 const NPIdentifier_Param& method, |
| 69 const std::vector<NPVariant_Param>& args, | 65 const std::vector<NPVariant_Param>& args, |
| 70 IPC::Message* reply_msg); | 66 IPC::Message* reply_msg); |
| 71 void OnHasProperty(const NPIdentifier_Param& name, | 67 void OnHasProperty(const NPIdentifier_Param& name, |
| (...skipping 18 matching lines...) Expand all Loading... |
| 90 NPObject* npobject_; | 86 NPObject* npobject_; |
| 91 scoped_refptr<PluginChannelBase> channel_; | 87 scoped_refptr<PluginChannelBase> channel_; |
| 92 int route_id_; | 88 int route_id_; |
| 93 gfx::NativeViewId containing_window_; | 89 gfx::NativeViewId containing_window_; |
| 94 | 90 |
| 95 // The url of the main frame hosting the plugin. | 91 // The url of the main frame hosting the plugin. |
| 96 GURL page_url_; | 92 GURL page_url_; |
| 97 }; | 93 }; |
| 98 | 94 |
| 99 #endif // CHROME_PLUGIN_NPOBJECT_STUB_H_ | 95 #endif // CHROME_PLUGIN_NPOBJECT_STUB_H_ |
| OLD | NEW |