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

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

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