| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "app/surface/transport_dib.h" | 12 #include "app/surface/transport_dib.h" |
| 13 #include "base/ref_counted.h" | 13 #include "base/ref_counted.h" |
| 14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
| 15 #include "base/weak_ptr.h" | 15 #include "base/weak_ptr.h" |
| 16 #include "gfx/native_widget_types.h" | 16 #include "gfx/native_widget_types.h" |
| 17 #include "gfx/rect.h" | 17 #include "gfx/rect.h" |
| 18 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
| 19 #include "ipc/ipc_channel.h" | 19 #include "ipc/ipc_channel.h" |
| 20 #include "ipc/ipc_message.h" | 20 #include "ipc/ipc_message.h" |
| 21 #include "webkit/plugins/npapi/webplugininfo.h" | 21 #include "webkit/glue/plugins/webplugininfo.h" |
| 22 #include "webkit/plugins/npapi/webplugin_delegate.h" | 22 #include "webkit/glue/plugins/webplugin_delegate.h" |
| 23 | 23 |
| 24 #if defined(OS_MACOSX) | 24 #if defined(OS_MACOSX) |
| 25 #include "base/hash_tables.h" | 25 #include "base/hash_tables.h" |
| 26 #include "base/linked_ptr.h" | 26 #include "base/linked_ptr.h" |
| 27 #endif | 27 #endif |
| 28 | 28 |
| 29 class CommandBufferProxy; | 29 class CommandBufferProxy; |
| 30 struct NPObject; | 30 struct NPObject; |
| 31 class NPObjectStub; | 31 class NPObjectStub; |
| 32 struct NPVariant_Param; | 32 struct NPVariant_Param; |
| 33 class PluginChannelHost; | 33 class PluginChannelHost; |
| 34 struct PluginHostMsg_URLRequest_Params; | 34 struct PluginHostMsg_URLRequest_Params; |
| 35 class RenderView; | 35 class RenderView; |
| 36 class SkBitmap; | 36 class SkBitmap; |
| 37 | 37 |
| 38 namespace base { | 38 namespace base { |
| 39 class SharedMemory; | 39 class SharedMemory; |
| 40 class WaitableEvent; | 40 class WaitableEvent; |
| 41 } | 41 } |
| 42 | 42 |
| 43 namespace skia { | 43 namespace skia { |
| 44 class PlatformCanvas; | 44 class PlatformCanvas; |
| 45 } | 45 } |
| 46 | 46 |
| 47 namespace webkit { | 47 namespace webkit_glue { |
| 48 namespace npapi { | |
| 49 class WebPlugin; | 48 class WebPlugin; |
| 50 } | 49 } |
| 51 } | |
| 52 | 50 |
| 53 // An implementation of WebPluginDelegate that proxies all calls to | 51 // An implementation of WebPluginDelegate that proxies all calls to |
| 54 // the plugin process. | 52 // the plugin process. |
| 55 class WebPluginDelegateProxy | 53 class WebPluginDelegateProxy |
| 56 : public webkit::npapi::WebPluginDelegate, | 54 : public webkit_glue::WebPluginDelegate, |
| 57 public IPC::Channel::Listener, | 55 public IPC::Channel::Listener, |
| 58 public IPC::Message::Sender, | 56 public IPC::Message::Sender, |
| 59 public base::SupportsWeakPtr<WebPluginDelegateProxy> { | 57 public base::SupportsWeakPtr<WebPluginDelegateProxy> { |
| 60 public: | 58 public: |
| 61 WebPluginDelegateProxy(const std::string& mime_type, | 59 WebPluginDelegateProxy(const std::string& mime_type, |
| 62 const base::WeakPtr<RenderView>& render_view); | 60 const base::WeakPtr<RenderView>& render_view); |
| 63 | 61 |
| 64 // WebPluginDelegate implementation: | 62 // WebPluginDelegate implementation: |
| 65 virtual void PluginDestroyed(); | 63 virtual void PluginDestroyed(); |
| 66 virtual bool Initialize(const GURL& url, | 64 virtual bool Initialize(const GURL& url, |
| 67 const std::vector<std::string>& arg_names, | 65 const std::vector<std::string>& arg_names, |
| 68 const std::vector<std::string>& arg_values, | 66 const std::vector<std::string>& arg_values, |
| 69 webkit::npapi::WebPlugin* plugin, | 67 webkit_glue::WebPlugin* plugin, |
| 70 bool load_manually); | 68 bool load_manually); |
| 71 virtual void UpdateGeometry(const gfx::Rect& window_rect, | 69 virtual void UpdateGeometry(const gfx::Rect& window_rect, |
| 72 const gfx::Rect& clip_rect); | 70 const gfx::Rect& clip_rect); |
| 73 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect); | 71 virtual void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& rect); |
| 74 virtual void Print(gfx::NativeDrawingContext context); | 72 virtual void Print(gfx::NativeDrawingContext context); |
| 75 virtual NPObject* GetPluginScriptableObject(); | 73 virtual NPObject* GetPluginScriptableObject(); |
| 76 virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, | 74 virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, |
| 77 int notify_id); | 75 int notify_id); |
| 78 virtual void SetFocus(bool focused); | 76 virtual void SetFocus(bool focused); |
| 79 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, | 77 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 108 | 106 |
| 109 virtual void DidReceiveManualResponse(const GURL& url, | 107 virtual void DidReceiveManualResponse(const GURL& url, |
| 110 const std::string& mime_type, | 108 const std::string& mime_type, |
| 111 const std::string& headers, | 109 const std::string& headers, |
| 112 uint32 expected_length, | 110 uint32 expected_length, |
| 113 uint32 last_modified); | 111 uint32 last_modified); |
| 114 virtual void DidReceiveManualData(const char* buffer, int length); | 112 virtual void DidReceiveManualData(const char* buffer, int length); |
| 115 virtual void DidFinishManualLoading(); | 113 virtual void DidFinishManualLoading(); |
| 116 virtual void DidManualLoadFail(); | 114 virtual void DidManualLoadFail(); |
| 117 virtual void InstallMissingPlugin(); | 115 virtual void InstallMissingPlugin(); |
| 118 virtual webkit::npapi::WebPluginResourceClient* CreateResourceClient( | 116 virtual webkit_glue::WebPluginResourceClient* CreateResourceClient( |
| 119 unsigned long resource_id, const GURL& url, int notify_id); | 117 unsigned long resource_id, const GURL& url, int notify_id); |
| 120 virtual webkit::npapi::WebPluginResourceClient* CreateSeekableResourceClient( | 118 virtual webkit_glue::WebPluginResourceClient* CreateSeekableResourceClient( |
| 121 unsigned long resource_id, int range_request_id); | 119 unsigned long resource_id, int range_request_id); |
| 122 | 120 |
| 123 CommandBufferProxy* CreateCommandBuffer(); | 121 CommandBufferProxy* CreateCommandBuffer(); |
| 124 void DestroyCommandBuffer(CommandBufferProxy* command_buffer); | 122 void DestroyCommandBuffer(CommandBufferProxy* command_buffer); |
| 125 | 123 |
| 126 gfx::PluginWindowHandle GetPluginWindowHandle(); | 124 gfx::PluginWindowHandle GetPluginWindowHandle(); |
| 127 | 125 |
| 128 protected: | 126 protected: |
| 129 template<class WebPluginDelegateProxy> friend class DeleteTask; | 127 template<class WebPluginDelegateProxy> friend class DeleteTask; |
| 130 ~WebPluginDelegateProxy(); | 128 ~WebPluginDelegateProxy(); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 224 |
| 227 OldTransportDIBMap old_transport_dibs_; | 225 OldTransportDIBMap old_transport_dibs_; |
| 228 #endif // OS_MACOSX | 226 #endif // OS_MACOSX |
| 229 | 227 |
| 230 #if defined(OS_WIN) | 228 #if defined(OS_WIN) |
| 231 // Returns true if we should update the plugin geometry synchronously. | 229 // Returns true if we should update the plugin geometry synchronously. |
| 232 bool UseSynchronousGeometryUpdates(); | 230 bool UseSynchronousGeometryUpdates(); |
| 233 #endif | 231 #endif |
| 234 | 232 |
| 235 base::WeakPtr<RenderView> render_view_; | 233 base::WeakPtr<RenderView> render_view_; |
| 236 webkit::npapi::WebPlugin* plugin_; | 234 webkit_glue::WebPlugin* plugin_; |
| 237 bool uses_shared_bitmaps_; | 235 bool uses_shared_bitmaps_; |
| 238 gfx::PluginWindowHandle window_; | 236 gfx::PluginWindowHandle window_; |
| 239 scoped_refptr<PluginChannelHost> channel_host_; | 237 scoped_refptr<PluginChannelHost> channel_host_; |
| 240 std::string mime_type_; | 238 std::string mime_type_; |
| 241 int instance_id_; | 239 int instance_id_; |
| 242 webkit::npapi::WebPluginInfo info_; | 240 WebPluginInfo info_; |
| 243 | 241 |
| 244 gfx::Rect plugin_rect_; | 242 gfx::Rect plugin_rect_; |
| 245 gfx::Rect clip_rect_; | 243 gfx::Rect clip_rect_; |
| 246 | 244 |
| 247 NPObject* npobject_; | 245 NPObject* npobject_; |
| 248 base::WeakPtr<NPObjectStub> window_script_object_; | 246 base::WeakPtr<NPObjectStub> window_script_object_; |
| 249 | 247 |
| 250 // Event passed in by the plugin process and is used to decide if | 248 // Event passed in by the plugin process and is used to decide if |
| 251 // messages need to be pumped in the NPP_HandleEvent sync call. | 249 // messages need to be pumped in the NPP_HandleEvent sync call. |
| 252 scoped_ptr<base::WaitableEvent> modal_loop_pump_messages_event_; | 250 scoped_ptr<base::WaitableEvent> modal_loop_pump_messages_event_; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 276 // This lets us know which portion of the backing store has been painted into. | 274 // This lets us know which portion of the backing store has been painted into. |
| 277 gfx::Rect backing_store_painted_; | 275 gfx::Rect backing_store_painted_; |
| 278 | 276 |
| 279 // The url of the main frame hosting the plugin. | 277 // The url of the main frame hosting the plugin. |
| 280 GURL page_url_; | 278 GURL page_url_; |
| 281 | 279 |
| 282 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); | 280 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); |
| 283 }; | 281 }; |
| 284 | 282 |
| 285 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_ | 283 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_ |
| OLD | NEW |