OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_PEPPER_IMPL_H_ | 5 #ifndef CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ |
6 #define WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_PEPPER_IMPL_H_ | 6 #define CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 #include <list> | 10 #include <list> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "app/gfx/native_widget_types.h" | 14 #include "app/gfx/native_widget_types.h" |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
16 #include "base/gfx/rect.h" | 16 #include "base/gfx/rect.h" |
17 #include "base/ref_counted.h" | 17 #include "base/ref_counted.h" |
18 #include "base/task.h" | 18 #include "base/task.h" |
| 19 #include "chrome/common/transport_dib.h" |
| 20 #include "skia/ext/platform_canvas.h" |
19 #include "third_party/npapi/bindings/npapi.h" | 21 #include "third_party/npapi/bindings/npapi.h" |
20 #include "webkit/glue/webcursor.h" | 22 #include "webkit/glue/webcursor.h" |
21 #include "webkit/glue/webplugin_delegate.h" | 23 #include "webkit/glue/webplugin_delegate.h" |
22 | 24 |
23 namespace NPAPI { | 25 namespace NPAPI { |
24 class PluginInstance; | 26 class PluginInstance; |
25 } | 27 } |
26 | 28 |
27 // An implementation of WebPluginDelegate for Pepper in-process plugins. | 29 // An implementation of WebPluginDelegate for Pepper in-process plugins. |
28 class WebPluginDelegatePepperImpl : public webkit_glue::WebPluginDelegate { | 30 class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate { |
29 public: | 31 public: |
30 static WebPluginDelegatePepperImpl* Create(const FilePath& filename, | 32 static WebPluginDelegatePepper* Create(const FilePath& filename, |
31 const std::string& mime_type, gfx::PluginWindowHandle containing_view); | 33 const std::string& mime_type, gfx::PluginWindowHandle containing_view); |
32 | 34 |
33 static bool IsPluginDelegateWindow(gfx::NativeWindow window); | 35 static bool IsPluginDelegateWindow(gfx::NativeWindow window); |
34 static bool GetPluginNameFromWindow(gfx::NativeWindow window, | 36 static bool GetPluginNameFromWindow(gfx::NativeWindow window, |
35 std::wstring *plugin_name); | 37 std::wstring *plugin_name); |
36 | 38 |
37 // Returns true if the window handle passed in is that of the dummy | 39 // Returns true if the window handle passed in is that of the dummy |
38 // activation window for windowless plugins. | 40 // activation window for windowless plugins. |
39 static bool IsDummyActivationWindow(gfx::NativeWindow window); | 41 static bool IsDummyActivationWindow(gfx::NativeWindow window); |
40 | 42 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // End of WebPluginDelegate implementation. | 80 // End of WebPluginDelegate implementation. |
79 | 81 |
80 bool IsWindowless() const { return true; } | 82 bool IsWindowless() const { return true; } |
81 gfx::Rect GetRect() const { return window_rect_; } | 83 gfx::Rect GetRect() const { return window_rect_; } |
82 gfx::Rect GetClipRect() const { return clip_rect_; } | 84 gfx::Rect GetClipRect() const { return clip_rect_; } |
83 | 85 |
84 // Returns the path for the library implementing this plugin. | 86 // Returns the path for the library implementing this plugin. |
85 FilePath GetPluginPath(); | 87 FilePath GetPluginPath(); |
86 | 88 |
87 private: | 89 private: |
88 friend class DeleteTask<WebPluginDelegatePepperImpl>; | 90 WebPluginDelegatePepper(gfx::PluginWindowHandle containing_view, |
89 | 91 NPAPI::PluginInstance *instance); |
90 WebPluginDelegatePepperImpl(gfx::PluginWindowHandle containing_view, | 92 ~WebPluginDelegatePepper(); |
91 NPAPI::PluginInstance *instance); | |
92 ~WebPluginDelegatePepperImpl(); | |
93 | 93 |
94 //---------------------------- | 94 //---------------------------- |
95 // used for windowless plugins | 95 // used for windowless plugins |
96 void WindowlessUpdateGeometry(const gfx::Rect& window_rect, | 96 virtual NPError InitializeRenderContext(NPRenderType type, |
97 const gfx::Rect& clip_rect); | 97 NPRenderContext* context); |
98 void WindowlessPaint(gfx::NativeDrawingContext hdc, const gfx::Rect& rect); | 98 virtual NPError FlushRenderContext(NPRenderContext* context); |
99 | 99 |
100 // Tells the plugin about the current state of the window. | 100 // Tells the plugin about the current state of the window. |
101 // See NPAPI NPP_SetWindow for more information. | 101 // See NPAPI NPP_SetWindow for more information. |
102 void WindowlessSetWindow(bool force_set_window); | 102 void WindowlessSetWindow(bool force_set_window); |
103 | 103 |
104 //----------------------------------------- | 104 //----------------------------------------- |
105 // used for windowed and windowless plugins | 105 // used for windowed and windowless plugins |
106 | 106 |
107 NPAPI::PluginInstance* instance() { return instance_.get(); } | 107 NPAPI::PluginInstance* instance() { return instance_.get(); } |
108 | 108 |
109 // Closes down and destroys our plugin instance. | 109 // Closes down and destroys our plugin instance. |
110 void DestroyInstance(); | 110 void DestroyInstance(); |
111 | 111 |
112 webkit_glue::WebPlugin* plugin_; | 112 webkit_glue::WebPlugin* plugin_; |
113 scoped_refptr<NPAPI::PluginInstance> instance_; | 113 scoped_refptr<NPAPI::PluginInstance> instance_; |
114 | 114 |
115 gfx::PluginWindowHandle parent_; | 115 gfx::PluginWindowHandle parent_; |
116 NPWindow window_; | 116 NPWindow window_; |
117 gfx::Rect window_rect_; | 117 gfx::Rect window_rect_; |
118 gfx::Rect clip_rect_; | 118 gfx::Rect clip_rect_; |
119 std::vector<gfx::Rect> cutout_rects_; | 119 std::vector<gfx::Rect> cutout_rects_; |
120 | 120 |
| 121 // Plugin graphics context implementation |
| 122 size_t buffer_size_; |
| 123 TransportDIB* plugin_buffer_; |
| 124 static uint32 next_buffer_id; |
| 125 skia::PlatformCanvas* plugin_canvas_; |
| 126 skia::PlatformCanvas* background_canvas_; |
| 127 |
121 // The url with which the plugin was instantiated. | 128 // The url with which the plugin was instantiated. |
122 std::string plugin_url_; | 129 std::string plugin_url_; |
123 | 130 |
124 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegatePepperImpl); | 131 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegatePepper); |
125 }; | 132 }; |
126 | 133 |
127 #endif // WEBKIT_GLUE_PLUGIN_WEBPLUGIN_DELEGATE_PEPPER_IMPL_H_ | 134 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PEPPER_H_ |
OLD | NEW |