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_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ | 5 #ifndef CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ |
6 #define CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ | 6 #define CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 22 matching lines...) Expand all Loading... |
33 struct NPObject; | 33 struct NPObject; |
34 struct PluginHostMsg_URLRequest_Params; | 34 struct PluginHostMsg_URLRequest_Params; |
35 class SkBitmap; | 35 class SkBitmap; |
36 | 36 |
37 namespace base { | 37 namespace base { |
38 class WaitableEvent; | 38 class WaitableEvent; |
39 } | 39 } |
40 | 40 |
41 | 41 |
42 namespace content { | 42 namespace content { |
43 class NPObjectStub; | |
44 class PluginChannelHost; | 43 class PluginChannelHost; |
45 class RenderFrameImpl; | 44 class RenderFrameImpl; |
46 class RenderViewImpl; | 45 class RenderViewImpl; |
47 class SharedMemoryBitmap; | 46 class SharedMemoryBitmap; |
48 class WebPluginImpl; | 47 class WebPluginImpl; |
49 | 48 |
50 // An implementation of WebPluginDelegate that proxies all calls to | 49 // An implementation of WebPluginDelegate that proxies all calls to |
51 // the plugin process. | 50 // the plugin process. |
52 class WebPluginDelegateProxy | 51 class WebPluginDelegateProxy |
53 : public WebPluginDelegate, | 52 : public WebPluginDelegate, |
54 public IPC::Listener, | 53 public IPC::Listener, |
55 public IPC::Sender, | 54 public IPC::Sender, |
56 public base::SupportsWeakPtr<WebPluginDelegateProxy> { | 55 public base::SupportsWeakPtr<WebPluginDelegateProxy> { |
57 public: | 56 public: |
58 WebPluginDelegateProxy(WebPluginImpl* plugin, | 57 WebPluginDelegateProxy(WebPluginImpl* plugin, |
59 const std::string& mime_type, | 58 const std::string& mime_type, |
60 const base::WeakPtr<RenderViewImpl>& render_view, | 59 const base::WeakPtr<RenderViewImpl>& render_view, |
61 RenderFrameImpl* render_frame); | 60 RenderFrameImpl* render_frame); |
62 | 61 |
63 // WebPluginDelegate implementation: | 62 // WebPluginDelegate implementation: |
64 void PluginDestroyed() override; | 63 void PluginDestroyed() override; |
65 bool Initialize(const GURL& url, | 64 bool Initialize(const GURL& url, |
66 const std::vector<std::string>& arg_names, | 65 const std::vector<std::string>& arg_names, |
67 const std::vector<std::string>& arg_values, | 66 const std::vector<std::string>& arg_values, |
68 bool load_manually) override; | 67 bool load_manually) override; |
69 void UpdateGeometry(const gfx::Rect& window_rect, | 68 void UpdateGeometry(const gfx::Rect& window_rect, |
70 const gfx::Rect& clip_rect) override; | 69 const gfx::Rect& clip_rect) override; |
71 void Paint(SkCanvas* canvas, const gfx::Rect& rect) override; | 70 void Paint(SkCanvas* canvas, const gfx::Rect& rect) override; |
72 NPObject* GetPluginScriptableObject() override; | |
73 struct _NPP* GetPluginNPP() override; | |
74 bool GetFormValue(base::string16* value) override; | 71 bool GetFormValue(base::string16* value) override; |
75 void SetFocus(bool focused) override; | 72 void SetFocus(bool focused) override; |
76 bool HandleInputEvent(const blink::WebInputEvent& event, | 73 bool HandleInputEvent(const blink::WebInputEvent& event, |
77 WebCursor::CursorInfo* cursor) override; | 74 WebCursor::CursorInfo* cursor) override; |
78 int GetProcessId() override; | 75 int GetProcessId() override; |
79 | 76 |
80 // Informs the plugin that its containing content view has gained or lost | 77 // Informs the plugin that its containing content view has gained or lost |
81 // first responder status. | 78 // first responder status. |
82 virtual void SetContentAreaFocus(bool has_focus); | 79 virtual void SetContentAreaFocus(bool has_focus); |
83 #if defined(OS_MACOSX) | 80 #if defined(OS_MACOSX) |
(...skipping 28 matching lines...) Expand all Loading... |
112 scoped_ptr<SharedMemoryBitmap> bitmap; | 109 scoped_ptr<SharedMemoryBitmap> bitmap; |
113 skia::RefPtr<SkCanvas> canvas; | 110 skia::RefPtr<SkCanvas> canvas; |
114 }; | 111 }; |
115 | 112 |
116 // Message handlers for messages that proxy WebPlugin methods, which | 113 // Message handlers for messages that proxy WebPlugin methods, which |
117 // we translate into calls to the real WebPlugin. | 114 // we translate into calls to the real WebPlugin. |
118 void OnCompleteURL(const std::string& url_in, std::string* url_out, | 115 void OnCompleteURL(const std::string& url_in, std::string* url_out, |
119 bool* result); | 116 bool* result); |
120 void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params); | 117 void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params); |
121 void OnInvalidateRect(const gfx::Rect& rect); | 118 void OnInvalidateRect(const gfx::Rect& rect); |
122 void OnGetWindowScriptNPObject(int route_id, bool* success); | |
123 void OnResolveProxy(const GURL& url, bool* result, std::string* proxy_list); | 119 void OnResolveProxy(const GURL& url, bool* result, std::string* proxy_list); |
124 void OnGetPluginElement(int route_id, bool* success); | |
125 void OnSetCookie(const GURL& url, | 120 void OnSetCookie(const GURL& url, |
126 const GURL& first_party_for_cookies, | 121 const GURL& first_party_for_cookies, |
127 const std::string& cookie); | 122 const std::string& cookie); |
128 void OnGetCookies(const GURL& url, const GURL& first_party_for_cookies, | 123 void OnGetCookies(const GURL& url, const GURL& first_party_for_cookies, |
129 std::string* cookies); | 124 std::string* cookies); |
130 void OnCancelDocumentLoad(); | 125 void OnCancelDocumentLoad(); |
131 void OnInitiateHTTPRangeRequest(const std::string& url, | 126 void OnInitiateHTTPRangeRequest(const std::string& url, |
132 const std::string& range_info, | 127 const std::string& range_info, |
133 int range_request_id); | 128 int range_request_id); |
134 void OnDidStartLoading(); | 129 void OnDidStartLoading(); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 bool uses_compositor_; | 205 bool uses_compositor_; |
211 #endif | 206 #endif |
212 scoped_refptr<PluginChannelHost> channel_host_; | 207 scoped_refptr<PluginChannelHost> channel_host_; |
213 std::string mime_type_; | 208 std::string mime_type_; |
214 int instance_id_; | 209 int instance_id_; |
215 WebPluginInfo info_; | 210 WebPluginInfo info_; |
216 | 211 |
217 gfx::Rect plugin_rect_; | 212 gfx::Rect plugin_rect_; |
218 gfx::Rect clip_rect_; | 213 gfx::Rect clip_rect_; |
219 | 214 |
220 NPObject* npobject_; | |
221 | |
222 // Dummy NPP used to uniquely identify this plugin. | |
223 scoped_ptr<NPP_t> npp_; | |
224 | |
225 // Bitmap for crashed plugin | 215 // Bitmap for crashed plugin |
226 SkBitmap* sad_plugin_; | 216 SkBitmap* sad_plugin_; |
227 | 217 |
228 // True if we got an invalidate from the plugin and are waiting for a paint. | 218 // True if we got an invalidate from the plugin and are waiting for a paint. |
229 bool invalidate_pending_; | 219 bool invalidate_pending_; |
230 | 220 |
231 // If the plugin is transparent or not. | 221 // If the plugin is transparent or not. |
232 bool transparent_; | 222 bool transparent_; |
233 | 223 |
234 // The index in the transport_stores_ array of the current front buffer | 224 // The index in the transport_stores_ array of the current front buffer |
(...skipping 10 matching lines...) Expand all Loading... |
245 | 235 |
246 // The url of the main frame hosting the plugin. | 236 // The url of the main frame hosting the plugin. |
247 GURL page_url_; | 237 GURL page_url_; |
248 | 238 |
249 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); | 239 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); |
250 }; | 240 }; |
251 | 241 |
252 } // namespace content | 242 } // namespace content |
253 | 243 |
254 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ | 244 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ |
OLD | NEW |