| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "app/gfx/native_widget_types.h" | 11 #include "app/gfx/native_widget_types.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/gfx/rect.h" | 13 #include "base/gfx/rect.h" |
| 14 #include "base/ref_counted.h" | 14 #include "base/ref_counted.h" |
| 15 #include "base/weak_ptr.h" | 15 #include "base/weak_ptr.h" |
| 16 #include "chrome/common/transport_dib.h" | 16 #include "chrome/common/transport_dib.h" |
| 17 #include "chrome/renderer/plugin_channel_host.h" | 17 #include "chrome/renderer/plugin_channel_host.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 #include "ipc/ipc_message.h" | 19 #include "ipc/ipc_message.h" |
| 20 #include "skia/ext/platform_canvas.h" | 20 #include "skia/ext/platform_canvas.h" |
| 21 #include "webkit/glue/webplugin.h" | 21 #include "webkit/glue/webplugin.h" |
| 22 #include "webkit/glue/webplugininfo.h" | 22 #include "webkit/glue/webplugininfo.h" |
| 23 #include "webkit/glue/webplugin_delegate.h" | 23 #include "webkit/glue/webplugin_delegate.h" |
| 24 | 24 |
| 25 #if defined(OS_MACOSX) |
| 26 #include "base/hash_tables.h" |
| 27 #include "base/linked_ptr.h" |
| 28 #endif |
| 29 |
| 25 struct NPObject; | 30 struct NPObject; |
| 26 class NPObjectStub; | 31 class NPObjectStub; |
| 27 struct NPVariant_Param; | 32 struct NPVariant_Param; |
| 28 struct PluginHostMsg_URLRequest_Params; | 33 struct PluginHostMsg_URLRequest_Params; |
| 29 class RenderView; | 34 class RenderView; |
| 30 class SkBitmap; | 35 class SkBitmap; |
| 31 | 36 |
| 32 namespace base { | 37 namespace base { |
| 33 class SharedMemory; | 38 class SharedMemory; |
| 34 class WaitableEvent; | 39 class WaitableEvent; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 void OnMissingPluginStatus(int status); | 131 void OnMissingPluginStatus(int status); |
| 127 void OnGetCPBrowsingContext(uint32* context); | 132 void OnGetCPBrowsingContext(uint32* context); |
| 128 void OnCancelDocumentLoad(); | 133 void OnCancelDocumentLoad(); |
| 129 void OnInitiateHTTPRangeRequest(const std::string& url, | 134 void OnInitiateHTTPRangeRequest(const std::string& url, |
| 130 const std::string& range_info, | 135 const std::string& range_info, |
| 131 intptr_t existing_stream, | 136 intptr_t existing_stream, |
| 132 bool notify_needed, | 137 bool notify_needed, |
| 133 intptr_t notify_data); | 138 intptr_t notify_data); |
| 134 void OnDeferResourceLoading(int resource_id, bool defer); | 139 void OnDeferResourceLoading(int resource_id, bool defer); |
| 135 | 140 |
| 141 #if defined(OS_MACOSX) |
| 142 void OnUpdateGeometry_ACK(int ack_key); |
| 143 #endif |
| 144 |
| 136 // Draw a graphic indicating a crashed plugin. | 145 // Draw a graphic indicating a crashed plugin. |
| 137 void PaintSadPlugin(WebKit::WebCanvas* canvas, const gfx::Rect& rect); | 146 void PaintSadPlugin(WebKit::WebCanvas* canvas, const gfx::Rect& rect); |
| 138 | 147 |
| 139 // Returns true if the given rectangle is different in the native drawing | 148 // Returns true if the given rectangle is different in the native drawing |
| 140 // context and the current background bitmap. | 149 // context and the current background bitmap. |
| 141 bool BackgroundChanged(gfx::NativeDrawingContext context, | 150 bool BackgroundChanged(gfx::NativeDrawingContext context, |
| 142 const gfx::Rect& rect); | 151 const gfx::Rect& rect); |
| 143 | 152 |
| 144 // Copies the given rectangle from the transport bitmap to the backing store. | 153 // Copies the given rectangle from the transport bitmap to the backing store. |
| 145 void CopyFromTransportToBacking(const gfx::Rect& rect); | 154 void CopyFromTransportToBacking(const gfx::Rect& rect); |
| 146 | 155 |
| 147 // Clears the shared memory section and canvases used for windowless plugins. | 156 // Clears the shared memory section and canvases used for windowless plugins. |
| 148 void ResetWindowlessBitmaps(); | 157 void ResetWindowlessBitmaps(); |
| 149 | 158 |
| 150 // Creates a shared memory section and canvas. | 159 // Creates a shared memory section and canvas. |
| 151 bool CreateBitmap(scoped_ptr<TransportDIB>* memory, | 160 bool CreateBitmap(scoped_ptr<TransportDIB>* memory, |
| 152 scoped_ptr<skia::PlatformCanvas>* canvas); | 161 scoped_ptr<skia::PlatformCanvas>* canvas); |
| 153 | 162 |
| 154 // Called for cleanup during plugin destruction. Normally right before the | 163 // Called for cleanup during plugin destruction. Normally right before the |
| 155 // plugin window gets destroyed, or when the plugin has crashed (at which | 164 // plugin window gets destroyed, or when the plugin has crashed (at which |
| 156 // point the window has already been destroyed). | 165 // point the window has already been destroyed). |
| 157 void WillDestroyWindow(); | 166 void WillDestroyWindow(); |
| 158 | 167 |
| 168 #if defined(OS_MACOSX) |
| 169 // The Mac TransportDIB implementation uses base::SharedMemory, which |
| 170 // cannot be disposed of if an in-flight UpdateGeometry message refers to |
| 171 // the shared memory file descriptor. The old_transport_dibs_ map holds |
| 172 // old TransportDIBs waiting to die. It's keyed by the |ack_key| values |
| 173 // used in UpdateGeometry messages. When an UpdateGeometry_ACK message |
| 174 // arrives, the associated RelatedTransportDIBs can be released. |
| 175 struct RelatedTransportDIBs { |
| 176 linked_ptr<TransportDIB> backing_store; |
| 177 linked_ptr<TransportDIB> transport_store; |
| 178 linked_ptr<TransportDIB> background_store; |
| 179 }; |
| 180 |
| 181 typedef base::hash_map<int, RelatedTransportDIBs> OldTransportDIBMap; |
| 182 |
| 183 OldTransportDIBMap old_transport_dibs_; |
| 184 #endif // OS_MACOSX |
| 185 |
| 159 base::WeakPtr<RenderView> render_view_; | 186 base::WeakPtr<RenderView> render_view_; |
| 160 webkit_glue::WebPlugin* plugin_; | 187 webkit_glue::WebPlugin* plugin_; |
| 161 bool windowless_; | 188 bool windowless_; |
| 162 gfx::PluginWindowHandle window_; | 189 gfx::PluginWindowHandle window_; |
| 163 scoped_refptr<PluginChannelHost> channel_host_; | 190 scoped_refptr<PluginChannelHost> channel_host_; |
| 164 std::string mime_type_; | 191 std::string mime_type_; |
| 165 int instance_id_; | 192 int instance_id_; |
| 166 WebPluginInfo info_; | 193 WebPluginInfo info_; |
| 167 | 194 |
| 168 gfx::Rect plugin_rect_; | 195 gfx::Rect plugin_rect_; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 195 // This lets us know which portion of the backing store has been painted into. | 222 // This lets us know which portion of the backing store has been painted into. |
| 196 gfx::Rect backing_store_painted_; | 223 gfx::Rect backing_store_painted_; |
| 197 | 224 |
| 198 // The url of the main frame hosting the plugin. | 225 // The url of the main frame hosting the plugin. |
| 199 GURL page_url_; | 226 GURL page_url_; |
| 200 | 227 |
| 201 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); | 228 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); |
| 202 }; | 229 }; |
| 203 | 230 |
| 204 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_ | 231 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_ |
| OLD | NEW |