OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ | 5 #ifndef CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ |
6 #define CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ | 6 #define CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/containers/hash_tables.h" | 10 #include "base/containers/hash_tables.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #if defined(OS_MACOSX) | 12 #if defined(OS_MACOSX) |
13 #include "base/mac/scoped_cftyperef.h" | 13 #include "base/mac/scoped_cftyperef.h" |
14 #endif | 14 #endif |
15 #include "base/memory/scoped_handle.h" | 15 #include "base/memory/scoped_handle.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/shared_memory.h" | 17 #include "base/memory/shared_memory.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/timer/timer.h" | 19 #include "base/timer/timer.h" |
20 #include "content/child/npapi/webplugin.h" | 20 #include "content/child/npapi/webplugin.h" |
21 #include "ipc/ipc_message.h" | 21 #include "ipc/ipc_message.h" |
| 22 #include "ipc/ipc_sender.h" |
22 #include "skia/ext/refptr.h" | 23 #include "skia/ext/refptr.h" |
23 #include "third_party/skia/include/core/SkCanvas.h" | 24 #include "third_party/skia/include/core/SkCanvas.h" |
24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
25 #if defined(USE_X11) | 26 #if defined(USE_X11) |
26 #include "ui/base/x/x11_util.h" | 27 #include "ui/base/x/x11_util.h" |
27 #endif | 28 #endif |
28 #include "ui/gl/gpu_preference.h" | 29 #include "ui/gl/gpu_preference.h" |
29 #include "ui/surface/transport_dib.h" | 30 #include "ui/surface/transport_dib.h" |
30 | 31 |
| 32 struct PluginMsg_FetchURL_Params; |
| 33 |
31 namespace content { | 34 namespace content { |
32 class PluginChannel; | 35 class PluginChannel; |
33 class WebPluginDelegateImpl; | 36 class WebPluginDelegateImpl; |
34 | 37 |
35 #if defined(OS_MACOSX) | 38 #if defined(OS_MACOSX) |
36 class WebPluginAcceleratedSurfaceProxy; | 39 class WebPluginAcceleratedSurfaceProxy; |
37 #endif | 40 #endif |
38 | 41 |
39 // This is an implementation of WebPlugin that proxies all calls to the | 42 // This is an implementation of WebPlugin that proxies all calls to the |
40 // renderer. | 43 // renderer. |
41 class WebPluginProxy : public WebPlugin { | 44 class WebPluginProxy : public WebPlugin, |
| 45 public IPC::Sender { |
42 public: | 46 public: |
43 // Creates a new proxy for WebPlugin, using the given sender to send the | 47 // Creates a new proxy for WebPlugin, using the given sender to send the |
44 // marshalled WebPlugin calls. | 48 // marshalled WebPlugin calls. |
45 WebPluginProxy(PluginChannel* channel, | 49 WebPluginProxy(PluginChannel* channel, |
46 int route_id, | 50 int route_id, |
47 const GURL& page_url, | 51 const GURL& page_url, |
48 int host_render_view_routing_id); | 52 int host_render_view_routing_id); |
49 virtual ~WebPluginProxy(); | 53 virtual ~WebPluginProxy(); |
50 | 54 |
51 void set_delegate(WebPluginDelegateImpl* d) { delegate_ = d; } | 55 void set_delegate(WebPluginDelegateImpl* d) { delegate_ = d; } |
52 | 56 |
53 // WebPlugin overrides | 57 // WebPlugin overrides |
54 virtual void SetWindow(gfx::PluginWindowHandle window) OVERRIDE; | 58 virtual void SetWindow(gfx::PluginWindowHandle window) OVERRIDE; |
55 virtual void SetAcceptsInputEvents(bool accepts) OVERRIDE; | 59 virtual void SetAcceptsInputEvents(bool accepts) OVERRIDE; |
56 virtual void WillDestroyWindow(gfx::PluginWindowHandle window) OVERRIDE; | 60 virtual void WillDestroyWindow(gfx::PluginWindowHandle window) OVERRIDE; |
57 #if defined(OS_WIN) | |
58 void SetWindowlessData(HANDLE pump_messages_event, | |
59 gfx::NativeViewId dummy_activation_window); | |
60 #endif | |
61 virtual void CancelResource(unsigned long id) OVERRIDE; | 61 virtual void CancelResource(unsigned long id) OVERRIDE; |
62 virtual void Invalidate() OVERRIDE; | 62 virtual void Invalidate() OVERRIDE; |
63 virtual void InvalidateRect(const gfx::Rect& rect) OVERRIDE; | 63 virtual void InvalidateRect(const gfx::Rect& rect) OVERRIDE; |
64 virtual NPObject* GetWindowScriptNPObject() OVERRIDE; | 64 virtual NPObject* GetWindowScriptNPObject() OVERRIDE; |
65 virtual NPObject* GetPluginElement() OVERRIDE; | 65 virtual NPObject* GetPluginElement() OVERRIDE; |
66 virtual bool FindProxyForUrl(const GURL& url, | 66 virtual bool FindProxyForUrl(const GURL& url, |
67 std::string* proxy_list) OVERRIDE; | 67 std::string* proxy_list) OVERRIDE; |
68 virtual void SetCookie(const GURL& url, | 68 virtual void SetCookie(const GURL& url, |
69 const GURL& first_party_for_cookies, | 69 const GURL& first_party_for_cookies, |
70 const std::string& cookie) OVERRIDE; | 70 const std::string& cookie) OVERRIDE; |
(...skipping 13 matching lines...) Expand all Loading... |
84 const TransportDIB::Handle& windowless_buffer1, | 84 const TransportDIB::Handle& windowless_buffer1, |
85 int windowless_buffer_index); | 85 int windowless_buffer_index); |
86 virtual void CancelDocumentLoad() OVERRIDE; | 86 virtual void CancelDocumentLoad() OVERRIDE; |
87 virtual void InitiateHTTPRangeRequest( | 87 virtual void InitiateHTTPRangeRequest( |
88 const char* url, const char* range_info, int range_request_id) OVERRIDE; | 88 const char* url, const char* range_info, int range_request_id) OVERRIDE; |
89 virtual void SetDeferResourceLoading(unsigned long resource_id, | 89 virtual void SetDeferResourceLoading(unsigned long resource_id, |
90 bool defer) OVERRIDE; | 90 bool defer) OVERRIDE; |
91 virtual bool IsOffTheRecord() OVERRIDE; | 91 virtual bool IsOffTheRecord() OVERRIDE; |
92 virtual void ResourceClientDeleted( | 92 virtual void ResourceClientDeleted( |
93 WebPluginResourceClient* resource_client) OVERRIDE; | 93 WebPluginResourceClient* resource_client) OVERRIDE; |
94 | 94 virtual void URLRedirectResponse(bool allow, int resource_id) OVERRIDE; |
| 95 virtual bool CheckIfRunInsecureContent(const GURL& url) OVERRIDE; |
| 96 #if defined(OS_WIN) |
| 97 void SetWindowlessData(HANDLE pump_messages_event, |
| 98 gfx::NativeViewId dummy_activation_window); |
| 99 #endif |
95 #if defined(OS_MACOSX) | 100 #if defined(OS_MACOSX) |
96 virtual void FocusChanged(bool focused) OVERRIDE; | 101 virtual void FocusChanged(bool focused) OVERRIDE; |
97 virtual void StartIme() OVERRIDE; | 102 virtual void StartIme() OVERRIDE; |
98 virtual WebPluginAcceleratedSurface* | 103 virtual WebPluginAcceleratedSurface* |
99 GetAcceleratedSurface(gfx::GpuPreference gpu_preference) OVERRIDE; | 104 GetAcceleratedSurface(gfx::GpuPreference gpu_preference) OVERRIDE; |
100 virtual void AcceleratedPluginEnabledRendering() OVERRIDE; | 105 virtual void AcceleratedPluginEnabledRendering() OVERRIDE; |
101 virtual void AcceleratedPluginAllocatedIOSurface(int32 width, | 106 virtual void AcceleratedPluginAllocatedIOSurface(int32 width, |
102 int32 height, | 107 int32 height, |
103 uint32 surface_id) OVERRIDE; | 108 uint32 surface_id) OVERRIDE; |
104 virtual void AcceleratedPluginSwappedIOSurface() OVERRIDE; | 109 virtual void AcceleratedPluginSwappedIOSurface() OVERRIDE; |
105 #endif | 110 #endif |
106 virtual void URLRedirectResponse(bool allow, int resource_id) OVERRIDE; | 111 |
| 112 // IPC::Sender implementation. |
| 113 virtual bool Send(IPC::Message* msg) OVERRIDE; |
107 | 114 |
108 // class-specific methods | 115 // class-specific methods |
109 | 116 |
110 // Returns a WebPluginResourceClient object given its id, or NULL if no | 117 // Returns a WebPluginResourceClient object given its id, or NULL if no |
111 // object with that id exists. | 118 // object with that id exists. |
112 WebPluginResourceClient* GetResourceClient(int id); | 119 WebPluginResourceClient* GetResourceClient(int id); |
113 | 120 |
114 // Returns the id of the renderer that contains this plugin. | 121 // Returns the id of the renderer that contains this plugin. |
115 int GetRendererId(); | 122 int GetRendererId(); |
116 | 123 |
(...skipping 24 matching lines...) Expand all Loading... |
141 public: | 148 public: |
142 explicit SharedTransportDIB(TransportDIB* dib); | 149 explicit SharedTransportDIB(TransportDIB* dib); |
143 TransportDIB* dib() { return dib_.get(); } | 150 TransportDIB* dib() { return dib_.get(); } |
144 private: | 151 private: |
145 friend class base::RefCounted<SharedTransportDIB>; | 152 friend class base::RefCounted<SharedTransportDIB>; |
146 ~SharedTransportDIB(); | 153 ~SharedTransportDIB(); |
147 | 154 |
148 scoped_ptr<TransportDIB> dib_; | 155 scoped_ptr<TransportDIB> dib_; |
149 }; | 156 }; |
150 | 157 |
151 bool Send(IPC::Message* msg); | |
152 | |
153 // Handler for sending over the paint event to the plugin. | 158 // Handler for sending over the paint event to the plugin. |
154 void OnPaint(const gfx::Rect& damaged_rect); | 159 void OnPaint(const gfx::Rect& damaged_rect); |
155 | 160 |
156 #if defined(OS_WIN) | 161 #if defined(OS_WIN) |
157 void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle, | 162 void CreateCanvasFromHandle(const TransportDIB::Handle& dib_handle, |
158 const gfx::Rect& window_rect, | 163 const gfx::Rect& window_rect, |
159 skia::RefPtr<SkCanvas>* canvas); | 164 skia::RefPtr<SkCanvas>* canvas); |
160 #elif defined(OS_MACOSX) | 165 #elif defined(OS_MACOSX) |
161 static void CreateDIBAndCGContextFromHandle( | 166 static void CreateDIBAndCGContextFromHandle( |
162 const TransportDIB::Handle& dib_handle, | 167 const TransportDIB::Handle& dib_handle, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 241 |
237 // Contains the routing id of the host render view. | 242 // Contains the routing id of the host render view. |
238 int host_render_view_routing_id_; | 243 int host_render_view_routing_id_; |
239 | 244 |
240 base::WeakPtrFactory<WebPluginProxy> weak_factory_; | 245 base::WeakPtrFactory<WebPluginProxy> weak_factory_; |
241 }; | 246 }; |
242 | 247 |
243 } // namespace content | 248 } // namespace content |
244 | 249 |
245 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ | 250 #endif // CONTENT_PLUGIN_WEBPLUGIN_PROXY_H_ |
OLD | NEW |