Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: chrome/plugin/webplugin_proxy.h

Issue 5961004: Revert 69755 - Move the NPAPI files from webkit/glue/plugins to webkit/plugin... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/plugin/webplugin_delegate_stub.cc ('k') | chrome/plugin/webplugin_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_PLUGIN_WEBPLUGIN_PROXY_H_ 5 #ifndef CHROME_PLUGIN_WEBPLUGIN_PROXY_H_
6 #define CHROME_PLUGIN_WEBPLUGIN_PROXY_H_ 6 #define CHROME_PLUGIN_WEBPLUGIN_PROXY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #if defined(USE_X11) 11 #if defined(USE_X11)
12 #include "app/x11_util.h" 12 #include "app/x11_util.h"
13 #endif 13 #endif
14 #include "app/surface/transport_dib.h" 14 #include "app/surface/transport_dib.h"
15 #include "base/hash_tables.h" 15 #include "base/hash_tables.h"
16 #include "base/ref_counted.h" 16 #include "base/ref_counted.h"
17 #if defined(OS_MACOSX) 17 #if defined(OS_MACOSX)
18 #include "base/mac/scoped_cftyperef.h" 18 #include "base/mac/scoped_cftyperef.h"
19 #endif 19 #endif
20 #include "base/scoped_handle.h" 20 #include "base/scoped_handle.h"
21 #include "base/scoped_ptr.h" 21 #include "base/scoped_ptr.h"
22 #include "base/shared_memory.h" 22 #include "base/shared_memory.h"
23 #include "base/timer.h" 23 #include "base/timer.h"
24 #include "chrome/common/chrome_plugin_api.h" 24 #include "chrome/common/chrome_plugin_api.h"
25 #include "googleurl/src/gurl.h" 25 #include "googleurl/src/gurl.h"
26 #include "ipc/ipc_message.h" 26 #include "ipc/ipc_message.h"
27 #include "webkit/plugins/npapi/webplugin.h" 27 #include "webkit/glue/plugins/webplugin.h"
28 28
29 class PluginChannel; 29 class PluginChannel;
30
31 namespace webkit {
32 namespace npapi {
33 class WebPluginDelegateImpl; 30 class WebPluginDelegateImpl;
34 }
35 }
36
37 #if defined(OS_MACOSX) 31 #if defined(OS_MACOSX)
38 class WebPluginAcceleratedSurfaceProxy; 32 class WebPluginAcceleratedSurfaceProxy;
39 #endif 33 #endif
40 34
41 // This is an implementation of WebPlugin that proxies all calls to the 35 // This is an implementation of WebPlugin that proxies all calls to the
42 // renderer. 36 // renderer.
43 class WebPluginProxy : public webkit::npapi::WebPlugin { 37 class WebPluginProxy : public webkit_glue::WebPlugin {
44 public: 38 public:
45 // Creates a new proxy for WebPlugin, using the given sender to send the 39 // Creates a new proxy for WebPlugin, using the given sender to send the
46 // marshalled WebPlugin calls. 40 // marshalled WebPlugin calls.
47 WebPluginProxy(PluginChannel* channel, 41 WebPluginProxy(PluginChannel* channel,
48 int route_id, 42 int route_id,
49 const GURL& page_url, 43 const GURL& page_url,
50 gfx::NativeViewId containing_window, 44 gfx::NativeViewId containing_window,
51 int host_render_view_routing_id); 45 int host_render_view_routing_id);
52 ~WebPluginProxy(); 46 ~WebPluginProxy();
53 47
54 void set_delegate(webkit::npapi::WebPluginDelegateImpl* d) { delegate_ = d; } 48 void set_delegate(WebPluginDelegateImpl* d) { delegate_ = d; }
55 49
56 // WebPlugin overrides 50 // WebPlugin overrides
57 virtual void SetWindow(gfx::PluginWindowHandle window); 51 virtual void SetWindow(gfx::PluginWindowHandle window);
58 52
59 // Whether input events should be sent to the delegate. 53 // Whether input events should be sent to the delegate.
60 virtual void SetAcceptsInputEvents(bool accepts); 54 virtual void SetAcceptsInputEvents(bool accepts);
61 55
62 virtual void WillDestroyWindow(gfx::PluginWindowHandle window); 56 virtual void WillDestroyWindow(gfx::PluginWindowHandle window);
63 #if defined(OS_WIN) 57 #if defined(OS_WIN)
64 void SetWindowlessPumpEvent(HANDLE pump_messages_event); 58 void SetWindowlessPumpEvent(HANDLE pump_messages_event);
(...skipping 27 matching lines...) Expand all
92 // Retrieves the browsing context associated with the renderer this plugin 86 // Retrieves the browsing context associated with the renderer this plugin
93 // is in. Calling multiple times will return the same value. 87 // is in. Calling multiple times will return the same value.
94 CPBrowsingContext GetCPBrowsingContext(); 88 CPBrowsingContext GetCPBrowsingContext();
95 89
96 // Retrieves the WebPluginProxy for the given context that was returned by 90 // Retrieves the WebPluginProxy for the given context that was returned by
97 // GetCPBrowsingContext, or NULL if not found. 91 // GetCPBrowsingContext, or NULL if not found.
98 static WebPluginProxy* FromCPBrowsingContext(CPBrowsingContext context); 92 static WebPluginProxy* FromCPBrowsingContext(CPBrowsingContext context);
99 93
100 // Returns a WebPluginResourceClient object given its id, or NULL if no 94 // Returns a WebPluginResourceClient object given its id, or NULL if no
101 // object with that id exists. 95 // object with that id exists.
102 webkit::npapi::WebPluginResourceClient* GetResourceClient(int id); 96 webkit_glue::WebPluginResourceClient* GetResourceClient(int id);
103 97
104 // Returns the id of the renderer that contains this plugin. 98 // Returns the id of the renderer that contains this plugin.
105 int GetRendererId(); 99 int GetRendererId();
106 100
107 // Returns the id of the associated render view. 101 // Returns the id of the associated render view.
108 int host_render_view_routing_id() const { 102 int host_render_view_routing_id() const {
109 return host_render_view_routing_id_; 103 return host_render_view_routing_id_;
110 } 104 }
111 105
112 // For windowless plugins, paints the given rectangle into the local buffer. 106 // For windowless plugins, paints the given rectangle into the local buffer.
113 void Paint(const gfx::Rect& rect); 107 void Paint(const gfx::Rect& rect);
114 108
115 // Callback from the renderer to let us know that a paint occurred. 109 // Callback from the renderer to let us know that a paint occurred.
116 void DidPaint(); 110 void DidPaint();
117 111
118 // Notification received on a plugin issued resource request creation. 112 // Notification received on a plugin issued resource request creation.
119 void OnResourceCreated(int resource_id, 113 void OnResourceCreated(int resource_id,
120 webkit::npapi::WebPluginResourceClient* client); 114 webkit_glue::WebPluginResourceClient* client);
121 115
122 virtual void HandleURLRequest(const char* url, 116 virtual void HandleURLRequest(const char* url,
123 const char* method, 117 const char* method,
124 const char* target, 118 const char* target,
125 const char* buf, 119 const char* buf,
126 unsigned int len, 120 unsigned int len,
127 int notify_id, 121 int notify_id,
128 bool popups_allowed, 122 bool popups_allowed,
129 bool notify_redirects); 123 bool notify_redirects);
130 void UpdateGeometry(const gfx::Rect& window_rect, 124 void UpdateGeometry(const gfx::Rect& window_rect,
131 const gfx::Rect& clip_rect, 125 const gfx::Rect& clip_rect,
132 const TransportDIB::Handle& windowless_buffer, 126 const TransportDIB::Handle& windowless_buffer,
133 const TransportDIB::Handle& background_buffer, 127 const TransportDIB::Handle& background_buffer,
134 bool transparent 128 bool transparent
135 #if defined(OS_MACOSX) 129 #if defined(OS_MACOSX)
136 , 130 ,
137 int ack_key 131 int ack_key
138 #endif 132 #endif
139 ); 133 );
140 virtual void CancelDocumentLoad(); 134 virtual void CancelDocumentLoad();
141 virtual void InitiateHTTPRangeRequest( 135 virtual void InitiateHTTPRangeRequest(
142 const char* url, const char* range_info, int range_request_id); 136 const char* url, const char* range_info, int range_request_id);
143 virtual void SetDeferResourceLoading(unsigned long resource_id, bool defer); 137 virtual void SetDeferResourceLoading(unsigned long resource_id, bool defer);
144 virtual bool IsOffTheRecord(); 138 virtual bool IsOffTheRecord();
145 virtual void ResourceClientDeleted( 139 virtual void ResourceClientDeleted(
146 webkit::npapi::WebPluginResourceClient* resource_client); 140 webkit_glue::WebPluginResourceClient* resource_client);
147 gfx::NativeViewId containing_window() { return containing_window_; } 141 gfx::NativeViewId containing_window() { return containing_window_; }
148 142
149 #if defined(OS_MACOSX) 143 #if defined(OS_MACOSX)
150 virtual void SetImeEnabled(bool enabled); 144 virtual void SetImeEnabled(bool enabled);
151 145
152 virtual void BindFakePluginWindowHandle(bool opaque); 146 virtual void BindFakePluginWindowHandle(bool opaque);
153 147
154 virtual webkit::npapi::WebPluginAcceleratedSurface* GetAcceleratedSurface(); 148 virtual webkit_glue::WebPluginAcceleratedSurface* GetAcceleratedSurface();
155 149
156 // Tell the browser (via the renderer) to invalidate because the 150 // Tell the browser (via the renderer) to invalidate because the
157 // accelerated buffers have changed. 151 // accelerated buffers have changed.
158 virtual void AcceleratedFrameBuffersDidSwap( 152 virtual void AcceleratedFrameBuffersDidSwap(
159 gfx::PluginWindowHandle window, uint64 surface_id); 153 gfx::PluginWindowHandle window, uint64 surface_id);
160 154
161 // Tell the renderer and browser to associate the given plugin handle with 155 // Tell the renderer and browser to associate the given plugin handle with
162 // |accelerated_surface_identifier|. The geometry is used to resize any 156 // |accelerated_surface_identifier|. The geometry is used to resize any
163 // native "window" (which on the Mac is a just a view). 157 // native "window" (which on the Mac is a just a view).
164 // This method is used when IOSurface support is available. 158 // This method is used when IOSurface support is available.
(...skipping 23 matching lines...) Expand all
188 bool Send(IPC::Message* msg); 182 bool Send(IPC::Message* msg);
189 183
190 // Handler for sending over the paint event to the plugin. 184 // Handler for sending over the paint event to the plugin.
191 void OnPaint(const gfx::Rect& damaged_rect); 185 void OnPaint(const gfx::Rect& damaged_rect);
192 186
193 // Updates the shared memory section where windowless plugins paint. 187 // Updates the shared memory section where windowless plugins paint.
194 void SetWindowlessBuffer(const TransportDIB::Handle& windowless_buffer, 188 void SetWindowlessBuffer(const TransportDIB::Handle& windowless_buffer,
195 const TransportDIB::Handle& background_buffer, 189 const TransportDIB::Handle& background_buffer,
196 const gfx::Rect& window_rect); 190 const gfx::Rect& window_rect);
197 191
198 typedef base::hash_map<int, webkit::npapi::WebPluginResourceClient*> 192 typedef base::hash_map<int, webkit_glue::WebPluginResourceClient*>
199 ResourceClientMap; 193 ResourceClientMap;
200 ResourceClientMap resource_clients_; 194 ResourceClientMap resource_clients_;
201 195
202 scoped_refptr<PluginChannel> channel_; 196 scoped_refptr<PluginChannel> channel_;
203 int route_id_; 197 int route_id_;
204 uint32 cp_browsing_context_; 198 uint32 cp_browsing_context_;
205 NPObject* window_npobject_; 199 NPObject* window_npobject_;
206 NPObject* plugin_element_; 200 NPObject* plugin_element_;
207 webkit::npapi::WebPluginDelegateImpl* delegate_; 201 WebPluginDelegateImpl* delegate_;
208 gfx::Rect damaged_rect_; 202 gfx::Rect damaged_rect_;
209 bool waiting_for_paint_; 203 bool waiting_for_paint_;
210 gfx::NativeViewId containing_window_; 204 gfx::NativeViewId containing_window_;
211 // The url of the main frame hosting the plugin. 205 // The url of the main frame hosting the plugin.
212 GURL page_url_; 206 GURL page_url_;
213 207
214 // Variables used for desynchronized windowless plugin painting. See note in 208 // Variables used for desynchronized windowless plugin painting. See note in
215 // webplugin_delegate_proxy.h for how this works. 209 // webplugin_delegate_proxy.h for how this works.
216 bool transparent_; 210 bool transparent_;
217 #if defined(OS_MACOSX) 211 #if defined(OS_MACOSX)
(...skipping 17 matching lines...) Expand all
235 229
236 #endif 230 #endif
237 231
238 // Contains the routing id of the host render view. 232 // Contains the routing id of the host render view.
239 int host_render_view_routing_id_; 233 int host_render_view_routing_id_;
240 234
241 ScopedRunnableMethodFactory<WebPluginProxy> runnable_method_factory_; 235 ScopedRunnableMethodFactory<WebPluginProxy> runnable_method_factory_;
242 }; 236 };
243 237
244 #endif // CHROME_PLUGIN_WEBPLUGIN_PROXY_H_ 238 #endif // CHROME_PLUGIN_WEBPLUGIN_PROXY_H_
OLDNEW
« no previous file with comments | « chrome/plugin/webplugin_delegate_stub.cc ('k') | chrome/plugin/webplugin_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698