| 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 CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H__ | 5 #ifndef CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H__ |
| 6 #define CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H__ | 6 #define CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H__ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/gfx/rect.h" | 12 #include "base/gfx/rect.h" |
| 13 #include "base/gfx/native_widget_types.h" | 13 #include "base/gfx/native_widget_types.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "chrome/common/ipc_message.h" | 15 #include "chrome/common/ipc_message.h" |
| 16 #include "chrome/common/transport_dib.h" |
| 16 #include "chrome/renderer/plugin_channel_host.h" | 17 #include "chrome/renderer/plugin_channel_host.h" |
| 17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 18 #include "skia/ext/platform_canvas.h" | 19 #include "skia/ext/platform_canvas.h" |
| 19 #include "webkit/glue/webplugin.h" | 20 #include "webkit/glue/webplugin.h" |
| 20 #include "webkit/glue/webplugin_delegate.h" | 21 #include "webkit/glue/webplugin_delegate.h" |
| 21 | 22 |
| 22 struct NPObject; | 23 struct NPObject; |
| 23 class NPObjectStub; | 24 class NPObjectStub; |
| 24 struct NPVariant_Param; | 25 struct NPVariant_Param; |
| 25 struct PluginHostMsg_URLRequest_Params; | 26 struct PluginHostMsg_URLRequest_Params; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 void OnCancelDocumentLoad(); | 140 void OnCancelDocumentLoad(); |
| 140 void OnInitiateHTTPRangeRequest(const std::string& url, | 141 void OnInitiateHTTPRangeRequest(const std::string& url, |
| 141 const std::string& range_info, | 142 const std::string& range_info, |
| 142 intptr_t existing_stream, | 143 intptr_t existing_stream, |
| 143 bool notify_needed, | 144 bool notify_needed, |
| 144 intptr_t notify_data); | 145 intptr_t notify_data); |
| 145 | 146 |
| 146 // Draw a graphic indicating a crashed plugin. | 147 // Draw a graphic indicating a crashed plugin. |
| 147 void PaintSadPlugin(gfx::NativeDrawingContext context, const gfx::Rect& rect); | 148 void PaintSadPlugin(gfx::NativeDrawingContext context, const gfx::Rect& rect); |
| 148 | 149 |
| 149 #if defined(OS_WIN) | 150 // Returns true if the given rectangle is different in the native drawing |
| 150 // Returns true if the given rectangle is different in the hdc and the | 151 // context and the current background bitmap. |
| 151 // current background bitmap. | 152 bool BackgroundChanged(gfx::NativeDrawingContext context, |
| 152 bool BackgroundChanged(HDC hdc, const gfx::Rect& rect); | 153 const gfx::Rect& rect); |
| 153 #else | |
| 154 // TODO(port): this should be portable; just avoiding windowless plugins for | |
| 155 // now. | |
| 156 #endif | |
| 157 | 154 |
| 158 // Copies the given rectangle from the transport bitmap to the backing store. | 155 // Copies the given rectangle from the transport bitmap to the backing store. |
| 159 void CopyFromTransportToBacking(const gfx::Rect& rect); | 156 void CopyFromTransportToBacking(const gfx::Rect& rect); |
| 160 | 157 |
| 161 // Clears the shared memory section and canvases used for windowless plugins. | 158 // Clears the shared memory section and canvases used for windowless plugins. |
| 162 void ResetWindowlessBitmaps(); | 159 void ResetWindowlessBitmaps(); |
| 163 | 160 |
| 164 // Creates a shared memory section and canvas. | 161 // Creates a shared memory section and canvas. |
| 165 bool CreateBitmap(scoped_ptr<base::SharedMemory>* memory, | 162 bool CreateBitmap(scoped_ptr<TransportDIB>* memory, |
| 166 scoped_ptr<skia::PlatformCanvas>* canvas); | 163 scoped_ptr<skia::PlatformCanvas>* canvas); |
| 167 | 164 |
| 168 RenderView* render_view_; | 165 RenderView* render_view_; |
| 169 WebPlugin* plugin_; | 166 WebPlugin* plugin_; |
| 170 bool windowless_; | 167 bool windowless_; |
| 171 scoped_refptr<PluginChannelHost> channel_host_; | 168 scoped_refptr<PluginChannelHost> channel_host_; |
| 172 std::string mime_type_; | 169 std::string mime_type_; |
| 173 std::string clsid_; | 170 std::string clsid_; |
| 174 int instance_id_; | 171 int instance_id_; |
| 175 FilePath plugin_path_; | 172 FilePath plugin_path_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 188 | 185 |
| 189 // True if we got an invalidate from the plugin and are waiting for a paint. | 186 // True if we got an invalidate from the plugin and are waiting for a paint. |
| 190 bool invalidate_pending_; | 187 bool invalidate_pending_; |
| 191 | 188 |
| 192 // Used to desynchronize windowless painting. When WebKit paints, we bitblt | 189 // Used to desynchronize windowless painting. When WebKit paints, we bitblt |
| 193 // from our backing store of what the plugin rectangle looks like. The | 190 // from our backing store of what the plugin rectangle looks like. The |
| 194 // plugin paints into the transport store, and we copy that to our backing | 191 // plugin paints into the transport store, and we copy that to our backing |
| 195 // store when we get an invalidate from it. The background bitmap is used | 192 // store when we get an invalidate from it. The background bitmap is used |
| 196 // for transparent plugins, as they need the backgroud data during painting. | 193 // for transparent plugins, as they need the backgroud data during painting. |
| 197 bool transparent_; | 194 bool transparent_; |
| 198 scoped_ptr<base::SharedMemory> backing_store_; | 195 scoped_ptr<TransportDIB> backing_store_; |
| 199 scoped_ptr<skia::PlatformCanvas> backing_store_canvas_; | 196 scoped_ptr<skia::PlatformCanvas> backing_store_canvas_; |
| 200 scoped_ptr<base::SharedMemory> transport_store_; | 197 scoped_ptr<TransportDIB> transport_store_; |
| 201 scoped_ptr<skia::PlatformCanvas> transport_store_canvas_; | 198 scoped_ptr<skia::PlatformCanvas> transport_store_canvas_; |
| 202 scoped_ptr<base::SharedMemory> background_store_; | 199 scoped_ptr<TransportDIB> background_store_; |
| 203 scoped_ptr<skia::PlatformCanvas> background_store_canvas_; | 200 scoped_ptr<skia::PlatformCanvas> background_store_canvas_; |
| 204 // This lets us know which portion of the backing store has been painted into. | 201 // This lets us know which portion of the backing store has been painted into. |
| 205 gfx::Rect backing_store_painted_; | 202 gfx::Rect backing_store_painted_; |
| 206 | 203 |
| 207 // The url of the main frame hosting the plugin. | 204 // The url of the main frame hosting the plugin. |
| 208 GURL page_url_; | 205 GURL page_url_; |
| 209 | 206 |
| 210 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateProxy); | 207 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateProxy); |
| 211 }; | 208 }; |
| 212 | 209 |
| 213 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_ | 210 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_ |
| OLD | NEW |