| 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_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ |
| 6 #define CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ | 6 #define CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 const WebKit::WebPluginParams& params, | 59 const WebKit::WebPluginParams& params, |
| 60 const base::FilePath& file_path, | 60 const base::FilePath& file_path, |
| 61 const base::WeakPtr<RenderViewImpl>& render_view); | 61 const base::WeakPtr<RenderViewImpl>& render_view); |
| 62 virtual ~WebPluginImpl(); | 62 virtual ~WebPluginImpl(); |
| 63 | 63 |
| 64 // Helper function for sorting post data. | 64 // Helper function for sorting post data. |
| 65 CONTENT_EXPORT static bool SetPostData(WebKit::WebURLRequest* request, | 65 CONTENT_EXPORT static bool SetPostData(WebKit::WebURLRequest* request, |
| 66 const char* buf, | 66 const char* buf, |
| 67 uint32 length); | 67 uint32 length); |
| 68 | 68 |
| 69 virtual WebPluginDelegate* delegate(); | 69 WebKit::WebFrame* webframe() { return webframe_; } |
| 70 WebPluginDelegate* delegate() { return delegate_; } |
| 70 | 71 |
| 71 private: | |
| 72 // WebKit::WebPlugin methods: | 72 // WebKit::WebPlugin methods: |
| 73 virtual bool initialize( | 73 virtual bool initialize( |
| 74 WebKit::WebPluginContainer* container); | 74 WebKit::WebPluginContainer* container); |
| 75 virtual void destroy(); | 75 virtual void destroy(); |
| 76 virtual NPObject* scriptableObject(); | 76 virtual NPObject* scriptableObject(); |
| 77 virtual struct _NPP* pluginNPP(); | 77 virtual struct _NPP* pluginNPP(); |
| 78 virtual bool getFormValue(WebKit::WebString& value); | 78 virtual bool getFormValue(WebKit::WebString& value); |
| 79 virtual void paint( | 79 virtual void paint( |
| 80 WebKit::WebCanvas* canvas, const WebKit::WebRect& paint_rect); | 80 WebKit::WebCanvas* canvas, const WebKit::WebRect& paint_rect); |
| 81 virtual void updateGeometry( | 81 virtual void updateGeometry( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 94 const WebKit::WebURL& url, void* notify_data); | 94 const WebKit::WebURL& url, void* notify_data); |
| 95 virtual void didFailLoadingFrameRequest( | 95 virtual void didFailLoadingFrameRequest( |
| 96 const WebKit::WebURL& url, void* notify_data, | 96 const WebKit::WebURL& url, void* notify_data, |
| 97 const WebKit::WebURLError& error); | 97 const WebKit::WebURLError& error); |
| 98 virtual bool isPlaceholder() OVERRIDE; | 98 virtual bool isPlaceholder() OVERRIDE; |
| 99 | 99 |
| 100 // WebPlugin implementation: | 100 // WebPlugin implementation: |
| 101 virtual void SetWindow(gfx::PluginWindowHandle window) OVERRIDE; | 101 virtual void SetWindow(gfx::PluginWindowHandle window) OVERRIDE; |
| 102 virtual void SetAcceptsInputEvents(bool accepts) OVERRIDE; | 102 virtual void SetAcceptsInputEvents(bool accepts) OVERRIDE; |
| 103 virtual void WillDestroyWindow(gfx::PluginWindowHandle window) OVERRIDE; | 103 virtual void WillDestroyWindow(gfx::PluginWindowHandle window) OVERRIDE; |
| 104 #if defined(OS_WIN) | |
| 105 void SetWindowlessData(HANDLE pump_messages_event, | |
| 106 gfx::NativeViewId dummy_activation_window) { } | |
| 107 void ReparentPluginWindow(HWND window, HWND parent) { } | |
| 108 void ReportExecutableMemory(size_t size) { } | |
| 109 #endif | |
| 110 virtual void CancelResource(unsigned long id) OVERRIDE; | 104 virtual void CancelResource(unsigned long id) OVERRIDE; |
| 111 virtual void Invalidate() OVERRIDE; | 105 virtual void Invalidate() OVERRIDE; |
| 112 virtual void InvalidateRect(const gfx::Rect& rect) OVERRIDE; | 106 virtual void InvalidateRect(const gfx::Rect& rect) OVERRIDE; |
| 113 virtual NPObject* GetWindowScriptNPObject() OVERRIDE; | 107 virtual NPObject* GetWindowScriptNPObject() OVERRIDE; |
| 114 virtual NPObject* GetPluginElement() OVERRIDE; | 108 virtual NPObject* GetPluginElement() OVERRIDE; |
| 115 virtual bool FindProxyForUrl(const GURL& url, | 109 virtual bool FindProxyForUrl(const GURL& url, |
| 116 std::string* proxy_list) OVERRIDE; | 110 std::string* proxy_list) OVERRIDE; |
| 117 virtual void SetCookie(const GURL& url, | 111 virtual void SetCookie(const GURL& url, |
| 118 const GURL& first_party_for_cookies, | 112 const GURL& first_party_for_cookies, |
| 119 const std::string& cookie) OVERRIDE; | 113 const std::string& cookie) OVERRIDE; |
| 120 virtual std::string GetCookies(const GURL& url, | 114 virtual std::string GetCookies(const GURL& url, |
| 121 const GURL& first_party_for_cookies) OVERRIDE; | 115 const GURL& first_party_for_cookies) OVERRIDE; |
| 116 virtual void HandleURLRequest(const char* url, |
| 117 const char *method, |
| 118 const char* target, |
| 119 const char* buf, |
| 120 unsigned int len, |
| 121 int notify_id, |
| 122 bool popups_allowed, |
| 123 bool notify_redirects) OVERRIDE; |
| 124 virtual void CancelDocumentLoad() OVERRIDE; |
| 125 virtual void InitiateHTTPRangeRequest(const char* url, |
| 126 const char* range_info, |
| 127 int pending_request_id) OVERRIDE; |
| 128 virtual bool IsOffTheRecord() OVERRIDE; |
| 129 virtual void SetDeferResourceLoading(unsigned long resource_id, |
| 130 bool defer) OVERRIDE; |
| 122 virtual void URLRedirectResponse(bool allow, int resource_id) OVERRIDE; | 131 virtual void URLRedirectResponse(bool allow, int resource_id) OVERRIDE; |
| 132 virtual bool CheckIfRunInsecureContent(const GURL& url) OVERRIDE; |
| 133 #if defined(OS_WIN) |
| 134 void SetWindowlessData(HANDLE pump_messages_event, |
| 135 gfx::NativeViewId dummy_activation_window) { } |
| 136 void ReparentPluginWindow(HWND window, HWND parent) { } |
| 137 void ReportExecutableMemory(size_t size) { } |
| 138 #endif |
| 123 #if defined(OS_MACOSX) | 139 #if defined(OS_MACOSX) |
| 124 virtual WebPluginAcceleratedSurface* GetAcceleratedSurface( | 140 virtual WebPluginAcceleratedSurface* GetAcceleratedSurface( |
| 125 gfx::GpuPreference gpu_preference) OVERRIDE; | 141 gfx::GpuPreference gpu_preference) OVERRIDE; |
| 126 virtual void AcceleratedPluginEnabledRendering() OVERRIDE; | 142 virtual void AcceleratedPluginEnabledRendering() OVERRIDE; |
| 127 virtual void AcceleratedPluginAllocatedIOSurface(int32 width, | 143 virtual void AcceleratedPluginAllocatedIOSurface(int32 width, |
| 128 int32 height, | 144 int32 height, |
| 129 uint32 surface_id) OVERRIDE; | 145 uint32 surface_id) OVERRIDE; |
| 130 virtual void AcceleratedPluginSwappedIOSurface() OVERRIDE; | 146 virtual void AcceleratedPluginSwappedIOSurface() OVERRIDE; |
| 131 #endif | 147 #endif |
| 132 | 148 |
| 149 private: |
| 133 // Given a (maybe partial) url, completes using the base url. | 150 // Given a (maybe partial) url, completes using the base url. |
| 134 GURL CompleteURL(const char* url); | 151 GURL CompleteURL(const char* url); |
| 135 | 152 |
| 136 enum RoutingStatus { | 153 enum RoutingStatus { |
| 137 ROUTED, | 154 ROUTED, |
| 138 NOT_ROUTED, | 155 NOT_ROUTED, |
| 139 INVALID_URL, | 156 INVALID_URL, |
| 140 GENERAL_FAILURE | 157 GENERAL_FAILURE |
| 141 }; | 158 }; |
| 142 | 159 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 const WebKit::WebURLError& error); | 225 const WebKit::WebURLError& error); |
| 209 | 226 |
| 210 // Helper function to remove the stored information about a resource | 227 // Helper function to remove the stored information about a resource |
| 211 // request given its index in m_clients. | 228 // request given its index in m_clients. |
| 212 void RemoveClient(size_t i); | 229 void RemoveClient(size_t i); |
| 213 | 230 |
| 214 // Helper function to remove the stored information about a resource | 231 // Helper function to remove the stored information about a resource |
| 215 // request given a handle. | 232 // request given a handle. |
| 216 void RemoveClient(WebKit::WebURLLoader* loader); | 233 void RemoveClient(WebKit::WebURLLoader* loader); |
| 217 | 234 |
| 218 virtual void HandleURLRequest(const char* url, | |
| 219 const char *method, | |
| 220 const char* target, | |
| 221 const char* buf, | |
| 222 unsigned int len, | |
| 223 int notify_id, | |
| 224 bool popups_allowed, | |
| 225 bool notify_redirects) OVERRIDE; | |
| 226 | |
| 227 virtual void CancelDocumentLoad() OVERRIDE; | |
| 228 | |
| 229 virtual void InitiateHTTPRangeRequest(const char* url, | |
| 230 const char* range_info, | |
| 231 int pending_request_id) OVERRIDE; | |
| 232 | |
| 233 virtual void SetDeferResourceLoading(unsigned long resource_id, | |
| 234 bool defer) OVERRIDE; | |
| 235 | |
| 236 // Ignore in-process plugins mode for this flag. | |
| 237 virtual bool IsOffTheRecord() OVERRIDE; | |
| 238 | |
| 239 // Handles HTTP multipart responses, i.e. responses received with a HTTP | 235 // Handles HTTP multipart responses, i.e. responses received with a HTTP |
| 240 // status code of 206. | 236 // status code of 206. |
| 241 // Returns false if response is not multipart (may be if we requested | 237 // Returns false if response is not multipart (may be if we requested |
| 242 // single range). | 238 // single range). |
| 243 bool HandleHttpMultipartResponse(const WebKit::WebURLResponse& response, | 239 bool HandleHttpMultipartResponse(const WebKit::WebURLResponse& response, |
| 244 WebPluginResourceClient* client); | 240 WebPluginResourceClient* client); |
| 245 | 241 |
| 246 void HandleURLRequestInternal(const char* url, | 242 void HandleURLRequestInternal(const char* url, |
| 247 const char* method, | 243 const char* method, |
| 248 const char* target, | 244 const char* target, |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 std::vector<std::string> arg_values_; | 329 std::vector<std::string> arg_values_; |
| 334 | 330 |
| 335 base::WeakPtrFactory<WebPluginImpl> weak_factory_; | 331 base::WeakPtrFactory<WebPluginImpl> weak_factory_; |
| 336 | 332 |
| 337 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); | 333 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); |
| 338 }; | 334 }; |
| 339 | 335 |
| 340 } // namespace content | 336 } // namespace content |
| 341 | 337 |
| 342 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ | 338 #endif // CONTENT_RENDERER_NPAPI_WEBPLUGIN_IMPL_H_ |
| OLD | NEW |