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