OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ | 5 #ifndef CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ |
6 #define CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ | 6 #define CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 #endif | 27 #endif |
28 | 28 |
29 struct NPObject; | 29 struct NPObject; |
30 struct PluginHostMsg_URLRequest_Params; | 30 struct PluginHostMsg_URLRequest_Params; |
31 class SkBitmap; | 31 class SkBitmap; |
32 | 32 |
33 namespace base { | 33 namespace base { |
34 class WaitableEvent; | 34 class WaitableEvent; |
35 } | 35 } |
36 | 36 |
37 namespace cc { | |
38 class SharedBitmap; | |
39 } | |
40 | 37 |
41 namespace content { | 38 namespace content { |
42 class NPObjectStub; | 39 class NPObjectStub; |
43 class PluginChannelHost; | 40 class PluginChannelHost; |
44 class RenderFrameImpl; | 41 class RenderFrameImpl; |
45 class RenderViewImpl; | 42 class RenderViewImpl; |
| 43 class SharedMemoryBitmap; |
46 class WebPluginImpl; | 44 class WebPluginImpl; |
47 | 45 |
48 // An implementation of WebPluginDelegate that proxies all calls to | 46 // An implementation of WebPluginDelegate that proxies all calls to |
49 // the plugin process. | 47 // the plugin process. |
50 class WebPluginDelegateProxy | 48 class WebPluginDelegateProxy |
51 : public WebPluginDelegate, | 49 : public WebPluginDelegate, |
52 public IPC::Listener, | 50 public IPC::Listener, |
53 public IPC::Sender, | 51 public IPC::Sender, |
54 public base::SupportsWeakPtr<WebPluginDelegateProxy> { | 52 public base::SupportsWeakPtr<WebPluginDelegateProxy> { |
55 public: | 53 public: |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 149 |
152 protected: | 150 protected: |
153 friend class base::DeleteHelper<WebPluginDelegateProxy>; | 151 friend class base::DeleteHelper<WebPluginDelegateProxy>; |
154 ~WebPluginDelegateProxy() override; | 152 ~WebPluginDelegateProxy() override; |
155 | 153 |
156 private: | 154 private: |
157 struct SharedBitmap { | 155 struct SharedBitmap { |
158 SharedBitmap(); | 156 SharedBitmap(); |
159 ~SharedBitmap(); | 157 ~SharedBitmap(); |
160 | 158 |
161 scoped_ptr<cc::SharedBitmap> bitmap; | 159 scoped_ptr<SharedMemoryBitmap> bitmap; |
162 scoped_ptr<SkCanvas> canvas; | 160 scoped_ptr<SkCanvas> canvas; |
163 }; | 161 }; |
164 | 162 |
165 // Message handlers for messages that proxy WebPlugin methods, which | 163 // Message handlers for messages that proxy WebPlugin methods, which |
166 // we translate into calls to the real WebPlugin. | 164 // we translate into calls to the real WebPlugin. |
167 void OnSetWindow(gfx::PluginWindowHandle window); | 165 void OnSetWindow(gfx::PluginWindowHandle window); |
168 void OnCompleteURL(const std::string& url_in, std::string* url_out, | 166 void OnCompleteURL(const std::string& url_in, std::string* url_out, |
169 bool* result); | 167 bool* result); |
170 void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params); | 168 void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params); |
171 void OnCancelResource(int id); | 169 void OnCancelResource(int id); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 223 } |
226 | 224 |
227 SkCanvas* front_buffer_canvas() const { | 225 SkCanvas* front_buffer_canvas() const { |
228 return transport_stores_[front_buffer_index()].canvas.get(); | 226 return transport_stores_[front_buffer_index()].canvas.get(); |
229 } | 227 } |
230 | 228 |
231 SkCanvas* back_buffer_canvas() const { | 229 SkCanvas* back_buffer_canvas() const { |
232 return transport_stores_[back_buffer_index()].canvas.get(); | 230 return transport_stores_[back_buffer_index()].canvas.get(); |
233 } | 231 } |
234 | 232 |
235 cc::SharedBitmap* front_buffer_bitmap() const { | 233 SharedMemoryBitmap* front_buffer_bitmap() const { |
236 return transport_stores_[front_buffer_index()].bitmap.get(); | 234 return transport_stores_[front_buffer_index()].bitmap.get(); |
237 } | 235 } |
238 | 236 |
239 cc::SharedBitmap* back_buffer_bitmap() const { | 237 SharedMemoryBitmap* back_buffer_bitmap() const { |
240 return transport_stores_[back_buffer_index()].bitmap.get(); | 238 return transport_stores_[back_buffer_index()].bitmap.get(); |
241 } | 239 } |
242 | 240 |
243 #if !defined(OS_WIN) | 241 #if !defined(OS_WIN) |
244 // Creates a process-local memory section and canvas. PlatformCanvas on | 242 // Creates a process-local memory section and canvas. PlatformCanvas on |
245 // Windows only works with a DIB, not arbitrary memory. | 243 // Windows only works with a DIB, not arbitrary memory. |
246 bool CreateLocalBitmap(std::vector<uint8>* memory, | 244 bool CreateLocalBitmap(std::vector<uint8>* memory, |
247 scoped_ptr<SkCanvas>* canvas); | 245 scoped_ptr<SkCanvas>* canvas); |
248 #endif | 246 #endif |
249 | 247 |
250 // Creates a shared memory section and canvas. | 248 // Creates a shared memory section and canvas. |
251 bool CreateSharedBitmap(scoped_ptr<cc::SharedBitmap>* memory, | 249 bool CreateSharedBitmap(scoped_ptr<SharedMemoryBitmap>* memory, |
252 scoped_ptr<SkCanvas>* canvas); | 250 scoped_ptr<SkCanvas>* canvas); |
253 | 251 |
254 // Called for cleanup during plugin destruction. Normally right before the | 252 // Called for cleanup during plugin destruction. Normally right before the |
255 // plugin window gets destroyed, or when the plugin has crashed (at which | 253 // plugin window gets destroyed, or when the plugin has crashed (at which |
256 // point the window has already been destroyed). | 254 // point the window has already been destroyed). |
257 void WillDestroyWindow(); | 255 void WillDestroyWindow(); |
258 | 256 |
259 #if defined(OS_WIN) | 257 #if defined(OS_WIN) |
260 // Returns true if we should update the plugin geometry synchronously. | 258 // Returns true if we should update the plugin geometry synchronously. |
261 bool UseSynchronousGeometryUpdates(); | 259 bool UseSynchronousGeometryUpdates(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 310 |
313 // The url of the main frame hosting the plugin. | 311 // The url of the main frame hosting the plugin. |
314 GURL page_url_; | 312 GURL page_url_; |
315 | 313 |
316 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); | 314 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); |
317 }; | 315 }; |
318 | 316 |
319 } // namespace content | 317 } // namespace content |
320 | 318 |
321 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ | 319 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ |
OLD | NEW |