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_WIN) | 80 #if defined(OS_WIN) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 scoped_ptr<SharedMemoryBitmap> bitmap; | 122 scoped_ptr<SharedMemoryBitmap> bitmap; |
126 skia::RefPtr<SkCanvas> canvas; | 123 skia::RefPtr<SkCanvas> canvas; |
127 }; | 124 }; |
128 | 125 |
129 // Message handlers for messages that proxy WebPlugin methods, which | 126 // Message handlers for messages that proxy WebPlugin methods, which |
130 // we translate into calls to the real WebPlugin. | 127 // we translate into calls to the real WebPlugin. |
131 void OnCompleteURL(const std::string& url_in, std::string* url_out, | 128 void OnCompleteURL(const std::string& url_in, std::string* url_out, |
132 bool* result); | 129 bool* result); |
133 void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params); | 130 void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params); |
134 void OnInvalidateRect(const gfx::Rect& rect); | 131 void OnInvalidateRect(const gfx::Rect& rect); |
135 void OnGetWindowScriptNPObject(int route_id, bool* success); | |
136 void OnResolveProxy(const GURL& url, bool* result, std::string* proxy_list); | 132 void OnResolveProxy(const GURL& url, bool* result, std::string* proxy_list); |
137 void OnGetPluginElement(int route_id, bool* success); | |
138 void OnSetCookie(const GURL& url, | 133 void OnSetCookie(const GURL& url, |
139 const GURL& first_party_for_cookies, | 134 const GURL& first_party_for_cookies, |
140 const std::string& cookie); | 135 const std::string& cookie); |
141 void OnGetCookies(const GURL& url, const GURL& first_party_for_cookies, | 136 void OnGetCookies(const GURL& url, const GURL& first_party_for_cookies, |
142 std::string* cookies); | 137 std::string* cookies); |
143 void OnCancelDocumentLoad(); | 138 void OnCancelDocumentLoad(); |
144 void OnInitiateHTTPRangeRequest(const std::string& url, | 139 void OnInitiateHTTPRangeRequest(const std::string& url, |
145 const std::string& range_info, | 140 const std::string& range_info, |
146 int range_request_id); | 141 int range_request_id); |
147 void OnDidStartLoading(); | 142 void OnDidStartLoading(); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 gfx::NativeViewId dummy_activation_window_; | 226 gfx::NativeViewId dummy_activation_window_; |
232 #endif | 227 #endif |
233 scoped_refptr<PluginChannelHost> channel_host_; | 228 scoped_refptr<PluginChannelHost> channel_host_; |
234 std::string mime_type_; | 229 std::string mime_type_; |
235 int instance_id_; | 230 int instance_id_; |
236 WebPluginInfo info_; | 231 WebPluginInfo info_; |
237 | 232 |
238 gfx::Rect plugin_rect_; | 233 gfx::Rect plugin_rect_; |
239 gfx::Rect clip_rect_; | 234 gfx::Rect clip_rect_; |
240 | 235 |
241 NPObject* npobject_; | |
242 | |
243 // Dummy NPP used to uniquely identify this plugin. | |
244 scoped_ptr<NPP_t> npp_; | |
245 | |
246 // Event passed in by the plugin process and is used to decide if messages | 236 // Event passed in by the plugin process and is used to decide if messages |
247 // need to be pumped in the NPP_HandleEvent sync call. | 237 // need to be pumped in the NPP_HandleEvent sync call. |
248 scoped_ptr<base::WaitableEvent> modal_loop_pump_messages_event_; | 238 scoped_ptr<base::WaitableEvent> modal_loop_pump_messages_event_; |
249 | 239 |
250 // Bitmap for crashed plugin | 240 // Bitmap for crashed plugin |
251 SkBitmap* sad_plugin_; | 241 SkBitmap* sad_plugin_; |
252 | 242 |
253 // True if we got an invalidate from the plugin and are waiting for a paint. | 243 // True if we got an invalidate from the plugin and are waiting for a paint. |
254 bool invalidate_pending_; | 244 bool invalidate_pending_; |
255 | 245 |
(...skipping 14 matching lines...) Expand all Loading... |
270 | 260 |
271 // The url of the main frame hosting the plugin. | 261 // The url of the main frame hosting the plugin. |
272 GURL page_url_; | 262 GURL page_url_; |
273 | 263 |
274 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); | 264 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); |
275 }; | 265 }; |
276 | 266 |
277 } // namespace content | 267 } // namespace content |
278 | 268 |
279 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ | 269 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ |
OLD | NEW |