OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHILD_NPAPI_NPOBJECT_PROXY_H_ | 8 #ifndef CONTENT_CHILD_NPAPI_NPOBJECT_PROXY_H_ |
9 #define CONTENT_CHILD_NPAPI_NPOBJECT_PROXY_H_ | 9 #define CONTENT_CHILD_NPAPI_NPOBJECT_PROXY_H_ |
10 | 10 |
(...skipping 24 matching lines...) Expand all Loading... |
35 public: | 35 public: |
36 virtual ~NPObjectProxy(); | 36 virtual ~NPObjectProxy(); |
37 | 37 |
38 static NPObject* Create(NPChannelBase* channel, | 38 static NPObject* Create(NPChannelBase* channel, |
39 int route_id, | 39 int route_id, |
40 int render_view_id, | 40 int render_view_id, |
41 const GURL& page_url, | 41 const GURL& page_url, |
42 NPP owner); | 42 NPP owner); |
43 | 43 |
44 // IPC::Sender implementation: | 44 // IPC::Sender implementation: |
45 virtual bool Send(IPC::Message* msg) OVERRIDE; | 45 virtual bool Send(IPC::Message* msg) override; |
46 int route_id() { return route_id_; } | 46 int route_id() { return route_id_; } |
47 NPChannelBase* channel() { return channel_.get(); } | 47 NPChannelBase* channel() { return channel_.get(); } |
48 | 48 |
49 // The next 9 functions are called on NPObjects from the plugin and browser. | 49 // The next 9 functions are called on NPObjects from the plugin and browser. |
50 static bool NPHasMethod(NPObject *obj, | 50 static bool NPHasMethod(NPObject *obj, |
51 NPIdentifier name); | 51 NPIdentifier name); |
52 static bool NPInvoke(NPObject *obj, | 52 static bool NPInvoke(NPObject *obj, |
53 NPIdentifier name, | 53 NPIdentifier name, |
54 const NPVariant *args, | 54 const NPVariant *args, |
55 uint32_t arg_count, | 55 uint32_t arg_count, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 bool is_default, | 87 bool is_default, |
88 NPIdentifier name, | 88 NPIdentifier name, |
89 const NPVariant *args, | 89 const NPVariant *args, |
90 uint32_t arg_count, | 90 uint32_t arg_count, |
91 NPVariant *result); | 91 NPVariant *result); |
92 | 92 |
93 static NPObjectProxy* GetProxy(NPObject* object); | 93 static NPObjectProxy* GetProxy(NPObject* object); |
94 static const NPClass* npclass() { return &npclass_proxy_; } | 94 static const NPClass* npclass() { return &npclass_proxy_; } |
95 | 95 |
96 // NPObjectBase implementation. | 96 // NPObjectBase implementation. |
97 virtual NPObject* GetUnderlyingNPObject() OVERRIDE; | 97 virtual NPObject* GetUnderlyingNPObject() override; |
98 | 98 |
99 virtual IPC::Listener* GetChannelListener() OVERRIDE; | 99 virtual IPC::Listener* GetChannelListener() override; |
100 | 100 |
101 private: | 101 private: |
102 NPObjectProxy(NPChannelBase* channel, | 102 NPObjectProxy(NPChannelBase* channel, |
103 int route_id, | 103 int route_id, |
104 int render_view_id, | 104 int render_view_id, |
105 const GURL& page_url); | 105 const GURL& page_url); |
106 | 106 |
107 // IPC::Listener implementation: | 107 // IPC::Listener implementation: |
108 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 108 virtual bool OnMessageReceived(const IPC::Message& msg) override; |
109 virtual void OnChannelError() OVERRIDE; | 109 virtual void OnChannelError() override; |
110 | 110 |
111 static NPObject* NPAllocate(NPP, NPClass*); | 111 static NPObject* NPAllocate(NPP, NPClass*); |
112 static void NPDeallocate(NPObject* npObj); | 112 static void NPDeallocate(NPObject* npObj); |
113 | 113 |
114 // This function is only caled on NPObjects from the plugin. | 114 // This function is only caled on NPObjects from the plugin. |
115 static void NPPInvalidate(NPObject *obj); | 115 static void NPPInvalidate(NPObject *obj); |
116 static NPClass npclass_proxy_; | 116 static NPClass npclass_proxy_; |
117 | 117 |
118 scoped_refptr<NPChannelBase> channel_; | 118 scoped_refptr<NPChannelBase> channel_; |
119 int route_id_; | 119 int route_id_; |
120 int render_view_id_; | 120 int render_view_id_; |
121 | 121 |
122 // The url of the main frame hosting the plugin. | 122 // The url of the main frame hosting the plugin. |
123 GURL page_url_; | 123 GURL page_url_; |
124 }; | 124 }; |
125 | 125 |
126 } // namespace content | 126 } // namespace content |
127 | 127 |
128 #endif // CONTENT_CHILD_NPAPI_NPOBJECT_PROXY_H_ | 128 #endif // CONTENT_CHILD_NPAPI_NPOBJECT_PROXY_H_ |
OLD | NEW |