| 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 "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/webplugin_delegate.h" | 23 #include "webkit/glue/webplugin_delegate.h" |
| 23 | 24 |
| 24 struct NPObject; | 25 struct NPObject; |
| 25 class NPObjectStub; | 26 class NPObjectStub; |
| 26 struct NPVariant_Param; | 27 struct NPVariant_Param; |
| 27 struct PluginHostMsg_URLRequest_Params; | 28 struct PluginHostMsg_URLRequest_Params; |
| 28 class RenderView; | 29 class RenderView; |
| 29 class SkBitmap; | 30 class SkBitmap; |
| 30 | 31 |
| 31 namespace base { | 32 namespace base { |
| 32 class SharedMemory; | 33 class SharedMemory; |
| 33 class WaitableEvent; | 34 class WaitableEvent; |
| 34 } | 35 } |
| 35 | 36 |
| 36 // An implementation of WebPluginDelegate that proxies all calls to | 37 // An implementation of WebPluginDelegate that proxies all calls to |
| 37 // the plugin process. | 38 // the plugin process. |
| 38 class WebPluginDelegateProxy : | 39 class WebPluginDelegateProxy : |
| 39 public webkit_glue::WebPluginDelegate, | 40 public webkit_glue::WebPluginDelegate, |
| 40 public IPC::Channel::Listener, | 41 public IPC::Channel::Listener, |
| 41 public IPC::Message::Sender, | 42 public IPC::Message::Sender, |
| 42 public base::SupportsWeakPtr<WebPluginDelegateProxy> { | 43 public base::SupportsWeakPtr<WebPluginDelegateProxy> { |
| 43 public: | 44 public: |
| 44 static WebPluginDelegateProxy* Create( | 45 WebPluginDelegateProxy(const std::string& mime_type, |
| 45 const GURL& url, | 46 const std::string& clsid, |
| 46 const std::string& mime_type, | 47 const base::WeakPtr<RenderView>& render_view); |
| 47 const std::string& clsid, | |
| 48 const base::WeakPtr<RenderView>& render_view); | |
| 49 | 48 |
| 50 // Called to drop our pointer to the window script object. | 49 // Called to drop our pointer to the window script object. |
| 51 void DropWindowScriptObject() { window_script_object_ = NULL; } | 50 void DropWindowScriptObject() { window_script_object_ = NULL; } |
| 52 | 51 |
| 53 // WebPluginDelegate implementation: | 52 // WebPluginDelegate implementation: |
| 54 virtual void PluginDestroyed(); | 53 virtual void PluginDestroyed(); |
| 55 virtual bool Initialize(const GURL& url, char** argn, char** argv, int argc, | 54 virtual bool Initialize(const GURL& url, |
| 56 webkit_glue::WebPlugin* plugin, bool load_manually); | 55 const std::vector<std::string>& arg_names, |
| 56 const std::vector<std::string>& arg_values, |
| 57 webkit_glue::WebPlugin* plugin, |
| 58 bool load_manually); |
| 57 virtual void UpdateGeometry(const gfx::Rect& window_rect, | 59 virtual void UpdateGeometry(const gfx::Rect& window_rect, |
| 58 const gfx::Rect& clip_rect); | 60 const gfx::Rect& clip_rect); |
| 59 virtual void Paint(gfx::NativeDrawingContext context, const gfx::Rect& rect); | 61 virtual void Paint(gfx::NativeDrawingContext context, const gfx::Rect& rect); |
| 60 virtual void Print(gfx::NativeDrawingContext context); | 62 virtual void Print(gfx::NativeDrawingContext context); |
| 61 virtual NPObject* GetPluginScriptableObject(); | 63 virtual NPObject* GetPluginScriptableObject(); |
| 62 virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, | 64 virtual void DidFinishLoadWithReason(const GURL& url, NPReason reason, |
| 63 intptr_t notify_data); | 65 intptr_t notify_data); |
| 64 virtual void SetFocus(); | 66 virtual void SetFocus(); |
| 65 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, | 67 virtual bool HandleInputEvent(const WebKit::WebInputEvent& event, |
| 66 WebKit::WebCursorInfo* cursor); | 68 WebKit::WebCursorInfo* cursor); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 79 intptr_t notify_data); | 81 intptr_t notify_data); |
| 80 | 82 |
| 81 virtual void DidReceiveManualResponse(const GURL& url, | 83 virtual void DidReceiveManualResponse(const GURL& url, |
| 82 const std::string& mime_type, | 84 const std::string& mime_type, |
| 83 const std::string& headers, | 85 const std::string& headers, |
| 84 uint32 expected_length, | 86 uint32 expected_length, |
| 85 uint32 last_modified); | 87 uint32 last_modified); |
| 86 virtual void DidReceiveManualData(const char* buffer, int length); | 88 virtual void DidReceiveManualData(const char* buffer, int length); |
| 87 virtual void DidFinishManualLoading(); | 89 virtual void DidFinishManualLoading(); |
| 88 virtual void DidManualLoadFail(); | 90 virtual void DidManualLoadFail(); |
| 89 virtual FilePath GetPluginPath(); | |
| 90 virtual void InstallMissingPlugin(); | 91 virtual void InstallMissingPlugin(); |
| 91 virtual webkit_glue::WebPluginResourceClient* CreateResourceClient( | 92 virtual webkit_glue::WebPluginResourceClient* CreateResourceClient( |
| 92 int resource_id, | 93 int resource_id, |
| 93 const GURL& url, | 94 const GURL& url, |
| 94 bool notify_needed, | 95 bool notify_needed, |
| 95 intptr_t notify_data, | 96 intptr_t notify_data, |
| 96 intptr_t existing_stream); | 97 intptr_t existing_stream); |
| 97 virtual bool IsWindowless() const; | |
| 98 virtual gfx::Rect GetRect() const; | |
| 99 virtual gfx::Rect GetClipRect() const; | |
| 100 virtual int GetQuirks() const; | |
| 101 | 98 |
| 102 protected: | 99 protected: |
| 103 template<class WebPluginDelegateProxy> friend class DeleteTask; | 100 template<class WebPluginDelegateProxy> friend class DeleteTask; |
| 104 ~WebPluginDelegateProxy(); | 101 ~WebPluginDelegateProxy(); |
| 105 | 102 |
| 106 private: | 103 private: |
| 107 WebPluginDelegateProxy(const std::string& mime_type, | |
| 108 const std::string& clsid, | |
| 109 const base::WeakPtr<RenderView>& render_view); | |
| 110 | |
| 111 // Message handlers for messages that proxy WebPlugin methods, which | 104 // Message handlers for messages that proxy WebPlugin methods, which |
| 112 // we translate into calls to the real WebPlugin. | 105 // we translate into calls to the real WebPlugin. |
| 113 void OnSetWindow(gfx::PluginWindowHandle window); | 106 void OnSetWindow(gfx::PluginWindowHandle window); |
| 114 #if defined(OS_WIN) | 107 #if defined(OS_WIN) |
| 115 void OnSetWindowlessPumpEvent(HANDLE modal_loop_pump_messages_event); | 108 void OnSetWindowlessPumpEvent(HANDLE modal_loop_pump_messages_event); |
| 116 #endif | 109 #endif |
| 117 void OnCompleteURL(const std::string& url_in, std::string* url_out, | 110 void OnCompleteURL(const std::string& url_in, std::string* url_out, |
| 118 bool* result); | 111 bool* result); |
| 119 void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params); | 112 void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params); |
| 120 void OnCancelResource(int id); | 113 void OnCancelResource(int id); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 void WillDestroyWindow(); | 161 void WillDestroyWindow(); |
| 169 | 162 |
| 170 base::WeakPtr<RenderView> render_view_; | 163 base::WeakPtr<RenderView> render_view_; |
| 171 webkit_glue::WebPlugin* plugin_; | 164 webkit_glue::WebPlugin* plugin_; |
| 172 bool windowless_; | 165 bool windowless_; |
| 173 gfx::PluginWindowHandle window_; | 166 gfx::PluginWindowHandle window_; |
| 174 scoped_refptr<PluginChannelHost> channel_host_; | 167 scoped_refptr<PluginChannelHost> channel_host_; |
| 175 std::string mime_type_; | 168 std::string mime_type_; |
| 176 std::string clsid_; | 169 std::string clsid_; |
| 177 int instance_id_; | 170 int instance_id_; |
| 178 FilePath plugin_path_; | 171 WebPluginInfo info_; |
| 179 | 172 |
| 180 gfx::Rect plugin_rect_; | 173 gfx::Rect plugin_rect_; |
| 181 | 174 |
| 182 NPObject* npobject_; | 175 NPObject* npobject_; |
| 183 NPObjectStub* window_script_object_; | 176 NPObjectStub* window_script_object_; |
| 184 | 177 |
| 185 // Event passed in by the plugin process and is used to decide if | 178 // Event passed in by the plugin process and is used to decide if |
| 186 // messages need to be pumped in the NPP_HandleEvent sync call. | 179 // messages need to be pumped in the NPP_HandleEvent sync call. |
| 187 scoped_ptr<base::WaitableEvent> modal_loop_pump_messages_event_; | 180 scoped_ptr<base::WaitableEvent> modal_loop_pump_messages_event_; |
| 188 | 181 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 207 // This lets us know which portion of the backing store has been painted into. | 200 // This lets us know which portion of the backing store has been painted into. |
| 208 gfx::Rect backing_store_painted_; | 201 gfx::Rect backing_store_painted_; |
| 209 | 202 |
| 210 // The url of the main frame hosting the plugin. | 203 // The url of the main frame hosting the plugin. |
| 211 GURL page_url_; | 204 GURL page_url_; |
| 212 | 205 |
| 213 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateProxy); | 206 DISALLOW_EVIL_CONSTRUCTORS(WebPluginDelegateProxy); |
| 214 }; | 207 }; |
| 215 | 208 |
| 216 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_ | 209 #endif // CHROME_RENDERER_WEBPLUGIN_DELEGATE_PROXY_H_ |
| OLD | NEW |