| 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 21 matching lines...) Expand all Loading... |
| 32 struct NPObject; | 32 struct NPObject; |
| 33 struct PluginHostMsg_URLRequest_Params; | 33 struct PluginHostMsg_URLRequest_Params; |
| 34 class SkBitmap; | 34 class SkBitmap; |
| 35 | 35 |
| 36 namespace base { | 36 namespace base { |
| 37 class WaitableEvent; | 37 class WaitableEvent; |
| 38 } | 38 } |
| 39 | 39 |
| 40 | 40 |
| 41 namespace content { | 41 namespace content { |
| 42 class NPObjectStub; | |
| 43 class PluginChannelHost; | 42 class PluginChannelHost; |
| 44 class RenderFrameImpl; | 43 class RenderFrameImpl; |
| 45 class RenderViewImpl; | 44 class RenderViewImpl; |
| 46 class SharedMemoryBitmap; | 45 class SharedMemoryBitmap; |
| 47 class WebPluginImpl; | 46 class WebPluginImpl; |
| 48 | 47 |
| 49 // An implementation of WebPluginDelegate that proxies all calls to | 48 // An implementation of WebPluginDelegate that proxies all calls to |
| 50 // the plugin process. | 49 // the plugin process. |
| 51 class WebPluginDelegateProxy | 50 class WebPluginDelegateProxy |
| 52 : public WebPluginDelegate, | 51 : public WebPluginDelegate, |
| 53 public IPC::Listener, | 52 public IPC::Listener, |
| 54 public IPC::Sender, | 53 public IPC::Sender, |
| 55 public base::SupportsWeakPtr<WebPluginDelegateProxy> { | 54 public base::SupportsWeakPtr<WebPluginDelegateProxy> { |
| 56 public: | 55 public: |
| 57 WebPluginDelegateProxy(WebPluginImpl* plugin, | 56 WebPluginDelegateProxy(WebPluginImpl* plugin, |
| 58 const std::string& mime_type, | 57 const std::string& mime_type, |
| 59 const base::WeakPtr<RenderViewImpl>& render_view, | 58 const base::WeakPtr<RenderViewImpl>& render_view, |
| 60 RenderFrameImpl* render_frame); | 59 RenderFrameImpl* render_frame); |
| 61 | 60 |
| 62 // WebPluginDelegate implementation: | 61 // WebPluginDelegate implementation: |
| 63 void PluginDestroyed() override; | 62 void PluginDestroyed() override; |
| 64 bool Initialize(const GURL& url, | 63 bool Initialize(const GURL& url, |
| 65 const std::vector<std::string>& arg_names, | 64 const std::vector<std::string>& arg_names, |
| 66 const std::vector<std::string>& arg_values, | 65 const std::vector<std::string>& arg_values, |
| 67 bool load_manually) override; | 66 bool load_manually) override; |
| 68 void UpdateGeometry(const gfx::Rect& window_rect, | 67 void UpdateGeometry(const gfx::Rect& window_rect, |
| 69 const gfx::Rect& clip_rect) override; | 68 const gfx::Rect& clip_rect) override; |
| 70 void Paint(SkCanvas* canvas, const gfx::Rect& rect) override; | 69 void Paint(SkCanvas* canvas, const gfx::Rect& rect) override; |
| 71 NPObject* GetPluginScriptableObject() override; | |
| 72 struct _NPP* GetPluginNPP() override; | |
| 73 bool GetFormValue(base::string16* value) override; | 70 bool GetFormValue(base::string16* value) override; |
| 74 void SetFocus(bool focused) override; | 71 void SetFocus(bool focused) override; |
| 75 bool HandleInputEvent(const blink::WebInputEvent& event, | 72 bool HandleInputEvent(const blink::WebInputEvent& event, |
| 76 WebCursor::CursorInfo* cursor) override; | 73 WebCursor::CursorInfo* cursor) override; |
| 77 int GetProcessId() override; | 74 int GetProcessId() override; |
| 78 | 75 |
| 79 // Informs the plugin that its containing content view has gained or lost | 76 // Informs the plugin that its containing content view has gained or lost |
| 80 // first responder status. | 77 // first responder status. |
| 81 virtual void SetContentAreaFocus(bool has_focus); | 78 virtual void SetContentAreaFocus(bool has_focus); |
| 82 #if defined(OS_WIN) | 79 #if defined(OS_WIN) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 }; | 125 }; |
| 129 | 126 |
| 130 // Message handlers for messages that proxy WebPlugin methods, which | 127 // Message handlers for messages that proxy WebPlugin methods, which |
| 131 // we translate into calls to the real WebPlugin. | 128 // we translate into calls to the real WebPlugin. |
| 132 void OnSetWindow(gfx::PluginWindowHandle window); | 129 void OnSetWindow(gfx::PluginWindowHandle window); |
| 133 void OnCompleteURL(const std::string& url_in, std::string* url_out, | 130 void OnCompleteURL(const std::string& url_in, std::string* url_out, |
| 134 bool* result); | 131 bool* result); |
| 135 void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params); | 132 void OnHandleURLRequest(const PluginHostMsg_URLRequest_Params& params); |
| 136 void OnCancelResource(int id); | 133 void OnCancelResource(int id); |
| 137 void OnInvalidateRect(const gfx::Rect& rect); | 134 void OnInvalidateRect(const gfx::Rect& rect); |
| 138 void OnGetWindowScriptNPObject(int route_id, bool* success); | |
| 139 void OnResolveProxy(const GURL& url, bool* result, std::string* proxy_list); | 135 void OnResolveProxy(const GURL& url, bool* result, std::string* proxy_list); |
| 140 void OnGetPluginElement(int route_id, bool* success); | |
| 141 void OnSetCookie(const GURL& url, | 136 void OnSetCookie(const GURL& url, |
| 142 const GURL& first_party_for_cookies, | 137 const GURL& first_party_for_cookies, |
| 143 const std::string& cookie); | 138 const std::string& cookie); |
| 144 void OnGetCookies(const GURL& url, const GURL& first_party_for_cookies, | 139 void OnGetCookies(const GURL& url, const GURL& first_party_for_cookies, |
| 145 std::string* cookies); | 140 std::string* cookies); |
| 146 void OnCancelDocumentLoad(); | 141 void OnCancelDocumentLoad(); |
| 147 void OnInitiateHTTPRangeRequest(const std::string& url, | 142 void OnInitiateHTTPRangeRequest(const std::string& url, |
| 148 const std::string& range_info, | 143 const std::string& range_info, |
| 149 int range_request_id); | 144 int range_request_id); |
| 150 void OnDidStartLoading(); | 145 void OnDidStartLoading(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 #endif | 233 #endif |
| 239 gfx::PluginWindowHandle window_; | 234 gfx::PluginWindowHandle window_; |
| 240 scoped_refptr<PluginChannelHost> channel_host_; | 235 scoped_refptr<PluginChannelHost> channel_host_; |
| 241 std::string mime_type_; | 236 std::string mime_type_; |
| 242 int instance_id_; | 237 int instance_id_; |
| 243 WebPluginInfo info_; | 238 WebPluginInfo info_; |
| 244 | 239 |
| 245 gfx::Rect plugin_rect_; | 240 gfx::Rect plugin_rect_; |
| 246 gfx::Rect clip_rect_; | 241 gfx::Rect clip_rect_; |
| 247 | 242 |
| 248 NPObject* npobject_; | |
| 249 | |
| 250 // Dummy NPP used to uniquely identify this plugin. | |
| 251 scoped_ptr<NPP_t> npp_; | |
| 252 | |
| 253 // Event passed in by the plugin process and is used to decide if messages | 243 // Event passed in by the plugin process and is used to decide if messages |
| 254 // need to be pumped in the NPP_HandleEvent sync call. | 244 // need to be pumped in the NPP_HandleEvent sync call. |
| 255 scoped_ptr<base::WaitableEvent> modal_loop_pump_messages_event_; | 245 scoped_ptr<base::WaitableEvent> modal_loop_pump_messages_event_; |
| 256 | 246 |
| 257 // Bitmap for crashed plugin | 247 // Bitmap for crashed plugin |
| 258 SkBitmap* sad_plugin_; | 248 SkBitmap* sad_plugin_; |
| 259 | 249 |
| 260 // True if we got an invalidate from the plugin and are waiting for a paint. | 250 // True if we got an invalidate from the plugin and are waiting for a paint. |
| 261 bool invalidate_pending_; | 251 bool invalidate_pending_; |
| 262 | 252 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 277 | 267 |
| 278 // The url of the main frame hosting the plugin. | 268 // The url of the main frame hosting the plugin. |
| 279 GURL page_url_; | 269 GURL page_url_; |
| 280 | 270 |
| 281 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); | 271 DISALLOW_COPY_AND_ASSIGN(WebPluginDelegateProxy); |
| 282 }; | 272 }; |
| 283 | 273 |
| 284 } // namespace content | 274 } // namespace content |
| 285 | 275 |
| 286 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ | 276 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_DELEGATE_PROXY_H_ |
| OLD | NEW |