| 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 // A proxy for NPObject that sends all calls to the object to an NPObjectStub | 5 // A proxy for NPObject that sends all calls to the object to an NPObjectStub |
| 6 // running in a different process. | 6 // running in a different process. |
| 7 | 7 |
| 8 #ifndef CONTENT_COMMON_NPOBJECT_PROXY_H_ | 8 #ifndef CONTENT_COMMON_NPOBJECT_PROXY_H_ |
| 9 #define CONTENT_COMMON_NPOBJECT_PROXY_H_ | 9 #define CONTENT_COMMON_NPOBJECT_PROXY_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 virtual ~NPObjectProxy(); | 34 virtual ~NPObjectProxy(); |
| 35 | 35 |
| 36 static NPObject* Create(NPChannelBase* channel, | 36 static NPObject* Create(NPChannelBase* channel, |
| 37 int route_id, | 37 int route_id, |
| 38 gfx::NativeViewId containing_window, | 38 gfx::NativeViewId containing_window, |
| 39 const GURL& page_url); | 39 const GURL& page_url); |
| 40 | 40 |
| 41 // IPC::Message::Sender implementation: | 41 // IPC::Message::Sender implementation: |
| 42 virtual bool Send(IPC::Message* msg); | 42 virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 43 int route_id() { return route_id_; } | 43 int route_id() { return route_id_; } |
| 44 NPChannelBase* channel() { return channel_; } | 44 NPChannelBase* channel() { return channel_; } |
| 45 | 45 |
| 46 // The next 9 functions are called on NPObjects from the plugin and browser. | 46 // The next 9 functions are called on NPObjects from the plugin and browser. |
| 47 static bool NPHasMethod(NPObject *obj, | 47 static bool NPHasMethod(NPObject *obj, |
| 48 NPIdentifier name); | 48 NPIdentifier name); |
| 49 static bool NPInvoke(NPObject *obj, | 49 static bool NPInvoke(NPObject *obj, |
| 50 NPIdentifier name, | 50 NPIdentifier name, |
| 51 const NPVariant *args, | 51 const NPVariant *args, |
| 52 uint32_t arg_count, | 52 uint32_t arg_count, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 bool is_default, | 84 bool is_default, |
| 85 NPIdentifier name, | 85 NPIdentifier name, |
| 86 const NPVariant *args, | 86 const NPVariant *args, |
| 87 uint32_t arg_count, | 87 uint32_t arg_count, |
| 88 NPVariant *result); | 88 NPVariant *result); |
| 89 | 89 |
| 90 static NPObjectProxy* GetProxy(NPObject* object); | 90 static NPObjectProxy* GetProxy(NPObject* object); |
| 91 static const NPClass* npclass() { return &npclass_proxy_; } | 91 static const NPClass* npclass() { return &npclass_proxy_; } |
| 92 | 92 |
| 93 // NPObjectBase implementation. | 93 // NPObjectBase implementation. |
| 94 virtual NPObject* GetUnderlyingNPObject(); | 94 virtual NPObject* GetUnderlyingNPObject() OVERRIDE; |
| 95 | 95 |
| 96 virtual IPC::Channel::Listener* GetChannelListener(); | 96 virtual IPC::Channel::Listener* GetChannelListener() OVERRIDE; |
| 97 | 97 |
| 98 private: | 98 private: |
| 99 NPObjectProxy(NPChannelBase* channel, | 99 NPObjectProxy(NPChannelBase* channel, |
| 100 int route_id, | 100 int route_id, |
| 101 gfx::NativeViewId containing_window, | 101 gfx::NativeViewId containing_window, |
| 102 const GURL& page_url); | 102 const GURL& page_url); |
| 103 | 103 |
| 104 // IPC::Channel::Listener implementation: | 104 // IPC::Channel::Listener implementation: |
| 105 virtual bool OnMessageReceived(const IPC::Message& msg); | 105 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 106 virtual void OnChannelError(); | 106 virtual void OnChannelError() OVERRIDE; |
| 107 | 107 |
| 108 static NPObject* NPAllocate(NPP, NPClass*); | 108 static NPObject* NPAllocate(NPP, NPClass*); |
| 109 static void NPDeallocate(NPObject* npObj); | 109 static void NPDeallocate(NPObject* npObj); |
| 110 | 110 |
| 111 // This function is only caled on NPObjects from the plugin. | 111 // This function is only caled on NPObjects from the plugin. |
| 112 static void NPPInvalidate(NPObject *obj); | 112 static void NPPInvalidate(NPObject *obj); |
| 113 static NPClass npclass_proxy_; | 113 static NPClass npclass_proxy_; |
| 114 | 114 |
| 115 scoped_refptr<NPChannelBase> channel_; | 115 scoped_refptr<NPChannelBase> channel_; |
| 116 int route_id_; | 116 int route_id_; |
| 117 gfx::NativeViewId containing_window_; | 117 gfx::NativeViewId containing_window_; |
| 118 | 118 |
| 119 // The url of the main frame hosting the plugin. | 119 // The url of the main frame hosting the plugin. |
| 120 GURL page_url_; | 120 GURL page_url_; |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 #endif // CONTENT_COMMON_NPOBJECT_PROXY_H_ | 123 #endif // CONTENT_COMMON_NPOBJECT_PROXY_H_ |
| OLD | NEW |