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 WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_WEBPLUGIN_IMPL_H_ |
6 #define WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_IMPL_H_ | 6 #define CONTENT_RENDERER_WEBPLUGIN_IMPL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "content/child/npapi/webplugin.h" |
| 17 #include "content/common/content_export.h" |
| 18 #include "content/common/webplugin_geometry.h" |
16 #include "third_party/WebKit/public/platform/WebRect.h" | 19 #include "third_party/WebKit/public/platform/WebRect.h" |
17 #include "third_party/WebKit/public/platform/WebString.h" | 20 #include "third_party/WebKit/public/platform/WebString.h" |
18 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 21 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
19 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 22 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
20 #include "third_party/WebKit/public/platform/WebVector.h" | 23 #include "third_party/WebKit/public/platform/WebVector.h" |
21 #include "third_party/WebKit/public/web/WebPlugin.h" | 24 #include "third_party/WebKit/public/web/WebPlugin.h" |
22 #include "ui/gfx/native_widget_types.h" | 25 #include "ui/gfx/native_widget_types.h" |
23 #include "url/gurl.h" | 26 #include "url/gurl.h" |
24 #include "webkit/plugins/npapi/webplugin.h" | |
25 #include "webkit/plugins/webkit_plugins_export.h" | |
26 | 27 |
27 namespace cc { | 28 namespace cc { |
28 class IOSurfaceLayer; | 29 class IOSurfaceLayer; |
29 } | 30 } |
30 | 31 |
31 namespace WebKit { | 32 namespace WebKit { |
32 class WebFrame; | 33 class WebFrame; |
33 class WebLayer; | 34 class WebLayer; |
34 class WebPluginContainer; | 35 class WebPluginContainer; |
35 class WebURLResponse; | 36 class WebURLResponse; |
36 class WebURLLoader; | 37 class WebURLLoader; |
37 class WebURLRequest; | 38 class WebURLRequest; |
38 } | 39 } |
39 | 40 |
40 namespace webkit_glue { | 41 namespace webkit_glue { |
41 class MultipartResponseDelegate; | 42 class MultipartResponseDelegate; |
42 } // namespace webkit_glue | 43 } // namespace webkit_glue |
43 | 44 |
44 namespace webkit { | 45 namespace content { |
45 namespace npapi { | |
46 | 46 |
47 class WebPluginDelegate; | 47 class WebPluginDelegate; |
48 class WebPluginPageDelegate; | 48 class WebPluginPageDelegate; |
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 WEBKIT_PLUGINS_EXPORT WebPluginImpl : | 53 class WebPluginImpl : public WebPlugin, |
54 NON_EXPORTED_BASE(public WebPlugin), | 54 public WebKit::WebPlugin, |
55 NON_EXPORTED_BASE(public WebKit::WebPlugin), | 55 public WebKit::WebURLLoaderClient { |
56 NON_EXPORTED_BASE(public WebKit::WebURLLoaderClient) { | |
57 public: | 56 public: |
58 WebPluginImpl( | 57 WebPluginImpl( |
59 WebKit::WebFrame* frame, | 58 WebKit::WebFrame* frame, |
60 const WebKit::WebPluginParams& params, | 59 const WebKit::WebPluginParams& params, |
61 const base::FilePath& file_path, | 60 const base::FilePath& file_path, |
62 const base::WeakPtr<WebPluginPageDelegate>& page_delegate); | 61 const base::WeakPtr<WebPluginPageDelegate>& page_delegate); |
63 virtual ~WebPluginImpl(); | 62 virtual ~WebPluginImpl(); |
64 | 63 |
65 // Helper function for sorting post data. | 64 // Helper function for sorting post data. |
66 static bool SetPostData(WebKit::WebURLRequest* request, | 65 CONTENT_EXPORT static bool SetPostData(WebKit::WebURLRequest* request, |
67 const char* buf, | 66 const char* buf, |
68 uint32 length); | 67 uint32 length); |
69 | 68 |
70 virtual WebPluginDelegate* delegate(); | 69 virtual WebPluginDelegate* delegate(); |
71 | 70 |
72 private: | 71 private: |
73 // WebKit::WebPlugin methods: | 72 // WebKit::WebPlugin methods: |
74 virtual bool initialize( | 73 virtual bool initialize( |
75 WebKit::WebPluginContainer* container); | 74 WebKit::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(); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // Holds the list of argument names and values passed to the plugin. We keep | 328 // Holds the list of argument names and values passed to the plugin. We keep |
330 // these so that we can re-initialize the plugin if we need to. | 329 // these so that we can re-initialize the plugin if we need to. |
331 std::vector<std::string> arg_names_; | 330 std::vector<std::string> arg_names_; |
332 std::vector<std::string> arg_values_; | 331 std::vector<std::string> arg_values_; |
333 | 332 |
334 base::WeakPtrFactory<WebPluginImpl> weak_factory_; | 333 base::WeakPtrFactory<WebPluginImpl> weak_factory_; |
335 | 334 |
336 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); | 335 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); |
337 }; | 336 }; |
338 | 337 |
339 } // namespace npapi | 338 } // namespace content |
340 } // namespace webkit | |
341 | 339 |
342 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGIN_IMPL_H_ | 340 #endif // CONTENT_RENDERER_WEBPLUGIN_IMPL_H_ |
OLD | NEW |