| 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_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ |
| 6 #define CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ | 6 #define CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 class WebURLRequest; | 38 class WebURLRequest; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace webkit_glue { | 41 namespace webkit_glue { |
| 42 class MultipartResponseDelegate; | 42 class MultipartResponseDelegate; |
| 43 } // namespace webkit_glue | 43 } // namespace webkit_glue |
| 44 | 44 |
| 45 namespace content { | 45 namespace content { |
| 46 class RenderFrameImpl; | 46 class RenderFrameImpl; |
| 47 class RenderViewImpl; | 47 class RenderViewImpl; |
| 48 class WebPluginDelegate; | 48 class WebPluginDelegateProxy; |
| 49 | 49 |
| 50 // This is the WebKit side of the plugin implementation that forwards calls, | 50 // This is the WebKit side of the plugin implementation that forwards calls, |
| 51 // after changing out of WebCore types, to a delegate. The delegate may | 51 // after changing out of WebCore types, to a delegate. The delegate may |
| 52 // be in a different process. | 52 // be in a different process. |
| 53 class WebPluginImpl : public WebPlugin, | 53 class WebPluginImpl : public WebPlugin, |
| 54 public blink::WebPlugin, | 54 public blink::WebPlugin, |
| 55 public blink::WebURLLoaderClient { | 55 public blink::WebURLLoaderClient { |
| 56 public: | 56 public: |
| 57 WebPluginImpl( | 57 WebPluginImpl( |
| 58 blink::WebFrame* frame, | 58 blink::WebFrame* frame, |
| 59 const blink::WebPluginParams& params, | 59 const blink::WebPluginParams& params, |
| 60 const base::FilePath& file_path, | 60 const base::FilePath& file_path, |
| 61 const base::WeakPtr<RenderViewImpl>& render_view, | 61 const base::WeakPtr<RenderViewImpl>& render_view, |
| 62 RenderFrameImpl* render_frame); | 62 RenderFrameImpl* render_frame); |
| 63 virtual ~WebPluginImpl(); | 63 virtual ~WebPluginImpl(); |
| 64 | 64 |
| 65 // Helper function for sorting post data. | 65 // Helper function for sorting post data. |
| 66 CONTENT_EXPORT static bool SetPostData(blink::WebURLRequest* request, | 66 CONTENT_EXPORT static bool SetPostData(blink::WebURLRequest* request, |
| 67 const char* buf, | 67 const char* buf, |
| 68 uint32 length); | 68 uint32 length); |
| 69 | 69 |
| 70 blink::WebFrame* webframe() { return webframe_; } | 70 blink::WebFrame* webframe() { return webframe_; } |
| 71 WebPluginDelegate* delegate() { return delegate_; } | |
| 72 | 71 |
| 73 // blink::WebPlugin methods: | 72 // blink::WebPlugin methods: |
| 74 virtual bool initialize( | 73 virtual bool initialize( |
| 75 blink::WebPluginContainer* container); | 74 blink::WebPluginContainer* container); |
| 76 virtual void destroy(); | 75 virtual void destroy(); |
| 77 virtual NPObject* scriptableObject(); | 76 virtual NPObject* scriptableObject(); |
| 78 virtual struct _NPP* pluginNPP(); | 77 virtual struct _NPP* pluginNPP(); |
| 79 virtual bool getFormValue(blink::WebString& value); | 78 virtual bool getFormValue(blink::WebString& value); |
| 80 virtual void paint( | 79 virtual void paint( |
| 81 blink::WebCanvas* canvas, const blink::WebRect& paint_rect); | 80 blink::WebCanvas* canvas, const blink::WebRect& paint_rect); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // Helper functions | 264 // Helper functions |
| 266 WebPluginResourceClient* GetClientFromLoader(blink::WebURLLoader* loader); | 265 WebPluginResourceClient* GetClientFromLoader(blink::WebURLLoader* loader); |
| 267 ClientInfo* GetClientInfoFromLoader(blink::WebURLLoader* loader); | 266 ClientInfo* GetClientInfoFromLoader(blink::WebURLLoader* loader); |
| 268 | 267 |
| 269 // Helper function to set the referrer on the request passed in. | 268 // Helper function to set the referrer on the request passed in. |
| 270 void SetReferrer(blink::WebURLRequest* request, Referrer referrer_flag); | 269 void SetReferrer(blink::WebURLRequest* request, Referrer referrer_flag); |
| 271 | 270 |
| 272 // Check for invalid chars like @, ;, \ before the first / (in path). | 271 // Check for invalid chars like @, ;, \ before the first / (in path). |
| 273 bool IsValidUrl(const GURL& url, Referrer referrer_flag); | 272 bool IsValidUrl(const GURL& url, Referrer referrer_flag); |
| 274 | 273 |
| 275 WebPluginDelegate* CreatePluginDelegate(); | |
| 276 | |
| 277 std::vector<ClientInfo> clients_; | 274 std::vector<ClientInfo> clients_; |
| 278 | 275 |
| 279 bool windowless_; | 276 bool windowless_; |
| 280 gfx::PluginWindowHandle window_; | 277 gfx::PluginWindowHandle window_; |
| 281 #if defined(OS_MACOSX) | 278 #if defined(OS_MACOSX) |
| 282 bool next_io_surface_allocated_; | 279 bool next_io_surface_allocated_; |
| 283 int32 next_io_surface_width_; | 280 int32 next_io_surface_width_; |
| 284 int32 next_io_surface_height_; | 281 int32 next_io_surface_height_; |
| 285 uint32 next_io_surface_id_; | 282 uint32 next_io_surface_id_; |
| 286 scoped_refptr<cc::IOSurfaceLayer> io_surface_layer_; | 283 scoped_refptr<cc::IOSurfaceLayer> io_surface_layer_; |
| 287 scoped_ptr<blink::WebLayer> web_layer_; | 284 scoped_ptr<blink::WebLayer> web_layer_; |
| 288 #endif | 285 #endif |
| 289 bool accepts_input_events_; | 286 bool accepts_input_events_; |
| 290 RenderFrameImpl* render_frame_; | 287 RenderFrameImpl* render_frame_; |
| 291 base::WeakPtr<RenderViewImpl> render_view_; | 288 base::WeakPtr<RenderViewImpl> render_view_; |
| 292 blink::WebFrame* webframe_; | 289 blink::WebFrame* webframe_; |
| 293 | 290 |
| 294 WebPluginDelegate* delegate_; | 291 WebPluginDelegateProxy* delegate_; |
| 295 | 292 |
| 296 // This is just a weak reference. | 293 // This is just a weak reference. |
| 297 blink::WebPluginContainer* container_; | 294 blink::WebPluginContainer* container_; |
| 298 | 295 |
| 299 // Unique identifier for this plugin, used to track script objects. | 296 // Unique identifier for this plugin, used to track script objects. |
| 300 struct _NPP* npp_; | 297 struct _NPP* npp_; |
| 301 | 298 |
| 302 typedef std::map<WebPluginResourceClient*, | 299 typedef std::map<WebPluginResourceClient*, |
| 303 webkit_glue::MultipartResponseDelegate*> | 300 webkit_glue::MultipartResponseDelegate*> |
| 304 MultiPartResponseHandlerMap; | 301 MultiPartResponseHandlerMap; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 333 std::vector<std::string> arg_values_; | 330 std::vector<std::string> arg_values_; |
| 334 | 331 |
| 335 base::WeakPtrFactory<WebPluginImpl> weak_factory_; | 332 base::WeakPtrFactory<WebPluginImpl> weak_factory_; |
| 336 | 333 |
| 337 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); | 334 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); |
| 338 }; | 335 }; |
| 339 | 336 |
| 340 } // namespace content | 337 } // namespace content |
| 341 | 338 |
| 342 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ | 339 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ |
| OLD | NEW |