| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 WEBKIT_GLUE_WEBPLUGIN_IMPL_H_ | 5 #ifndef WEBKIT_GLUE_WEBPLUGIN_IMPL_H_ |
| 6 #define WEBKIT_GLUE_WEBPLUGIN_IMPL_H_ | 6 #define WEBKIT_GLUE_WEBPLUGIN_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h" |
| 23 #include "webkit/glue/webplugin.h" | 23 #include "webkit/glue/webplugin.h" |
| 24 | 24 |
| 25 class WebViewDelegate; | 25 class WebViewDelegate; |
| 26 | 26 |
| 27 namespace WebKit { | 27 namespace WebKit { |
| 28 class WebFrame; | 28 class WebFrame; |
| 29 class WebPluginContainer; | 29 class WebPluginContainer; |
| 30 class WebURLResponse; | 30 class WebURLResponse; |
| 31 class WebURLLoader; | 31 class WebURLLoader; |
| 32 class WebURLRequest; |
| 32 } | 33 } |
| 33 | 34 |
| 34 namespace webkit_glue { | 35 namespace webkit_glue { |
| 35 | 36 |
| 36 class MultipartResponseDelegate; | 37 class MultipartResponseDelegate; |
| 37 class WebPluginDelegate; | 38 class WebPluginDelegate; |
| 38 class WebPluginPageDelegate; | 39 class WebPluginPageDelegate; |
| 39 | 40 |
| 40 // This is the WebKit side of the plugin implementation that forwards calls, | 41 // This is the WebKit side of the plugin implementation that forwards calls, |
| 41 // after changing out of WebCore types, to a delegate. The delegate may | 42 // after changing out of WebCore types, to a delegate. The delegate may |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 bool notify_needed, intptr_t notify_data, | 103 bool notify_needed, intptr_t notify_data, |
| 103 bool popups_allowed); | 104 bool popups_allowed); |
| 104 | 105 |
| 105 enum RoutingStatus { | 106 enum RoutingStatus { |
| 106 ROUTED, | 107 ROUTED, |
| 107 NOT_ROUTED, | 108 NOT_ROUTED, |
| 108 INVALID_URL, | 109 INVALID_URL, |
| 109 GENERAL_FAILURE | 110 GENERAL_FAILURE |
| 110 }; | 111 }; |
| 111 | 112 |
| 113 // Determines the referrer value sent along with outgoing HTTP requests |
| 114 // issued by plugins. |
| 115 enum Referrer { |
| 116 PLUGIN_SRC, |
| 117 DOCUMENT_URL, |
| 118 NO_REFERRER |
| 119 }; |
| 120 |
| 112 // Given a download request, check if we need to route the output to a frame. | 121 // Given a download request, check if we need to route the output to a frame. |
| 113 // Returns ROUTED if the load is done and routed to a frame, NOT_ROUTED or | 122 // Returns ROUTED if the load is done and routed to a frame, NOT_ROUTED or |
| 114 // corresponding error codes otherwise. | 123 // corresponding error codes otherwise. |
| 115 RoutingStatus RouteToFrame(const char* method, bool is_javascript_url, | 124 RoutingStatus RouteToFrame(const char* method, bool is_javascript_url, |
| 116 const char* target, unsigned int len, | 125 const char* target, unsigned int len, |
| 117 const char* buf, bool is_file_data, | 126 const char* buf, bool is_file_data, |
| 118 bool notify_needed, intptr_t notify_data, | 127 bool notify_needed, intptr_t notify_data, |
| 119 const char* url); | 128 const char* url, Referrer referrer_flag); |
| 120 | 129 |
| 121 // Cancels a pending request. | 130 // Cancels a pending request. |
| 122 void CancelResource(int id); | 131 void CancelResource(int id); |
| 123 | 132 |
| 124 // Returns the next avaiable resource id. | 133 // Returns the next avaiable resource id. |
| 125 int GetNextResourceId(); | 134 int GetNextResourceId(); |
| 126 | 135 |
| 127 // Initiates HTTP GET/POST requests. | 136 // Initiates HTTP GET/POST requests. |
| 128 // Returns true on success. | 137 // Returns true on success. |
| 129 bool InitiateHTTPRequest(int resource_id, WebPluginResourceClient* client, | 138 bool InitiateHTTPRequest(int resource_id, WebPluginResourceClient* client, |
| 130 const char* method, const char* buf, int buf_len, | 139 const char* method, const char* buf, int buf_len, |
| 131 const GURL& url, const char* range_info, | 140 const GURL& url, const char* range_info, |
| 132 bool use_plugin_src_as_referer); | 141 Referrer referrer_flag); |
| 133 | 142 |
| 134 gfx::Rect GetWindowClipRect(const gfx::Rect& rect); | 143 gfx::Rect GetWindowClipRect(const gfx::Rect& rect); |
| 135 | 144 |
| 136 NPObject* GetWindowScriptNPObject(); | 145 NPObject* GetWindowScriptNPObject(); |
| 137 NPObject* GetPluginElement(); | 146 NPObject* GetPluginElement(); |
| 138 | 147 |
| 139 void SetCookie(const GURL& url, | 148 void SetCookie(const GURL& url, |
| 140 const GURL& first_party_for_cookies, | 149 const GURL& first_party_for_cookies, |
| 141 const std::string& cookie); | 150 const std::string& cookie); |
| 142 std::string GetCookies(const GURL& url, | 151 std::string GetCookies(const GURL& url, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // Handles HTTP multipart responses, i.e. responses received with a HTTP | 211 // Handles HTTP multipart responses, i.e. responses received with a HTTP |
| 203 // status code of 206. | 212 // status code of 206. |
| 204 void HandleHttpMultipartResponse(const WebKit::WebURLResponse& response, | 213 void HandleHttpMultipartResponse(const WebKit::WebURLResponse& response, |
| 205 WebPluginResourceClient* client); | 214 WebPluginResourceClient* client); |
| 206 | 215 |
| 207 void HandleURLRequestInternal(const char *method, bool is_javascript_url, | 216 void HandleURLRequestInternal(const char *method, bool is_javascript_url, |
| 208 const char* target, unsigned int len, | 217 const char* target, unsigned int len, |
| 209 const char* buf, bool is_file_data, | 218 const char* buf, bool is_file_data, |
| 210 bool notify, const char* url, | 219 bool notify, const char* url, |
| 211 intptr_t notify_data, bool popups_allowed, | 220 intptr_t notify_data, bool popups_allowed, |
| 212 bool use_plugin_src_as_referrer); | 221 Referrer referrer_flag); |
| 213 | 222 |
| 214 // Tears down the existing plugin instance and creates a new plugin instance | 223 // Tears down the existing plugin instance and creates a new plugin instance |
| 215 // to handle the response identified by the loader parameter. | 224 // to handle the response identified by the loader parameter. |
| 216 bool ReinitializePluginForResponse(WebKit::WebURLLoader* loader); | 225 bool ReinitializePluginForResponse(WebKit::WebURLLoader* loader); |
| 217 | 226 |
| 218 // Delayed task for downloading the plugin source URL. | 227 // Delayed task for downloading the plugin source URL. |
| 219 void OnDownloadPluginSrcUrl(); | 228 void OnDownloadPluginSrcUrl(); |
| 220 | 229 |
| 221 struct ClientInfo { | 230 struct ClientInfo { |
| 222 int id; | 231 int id; |
| 223 WebPluginResourceClient* client; | 232 WebPluginResourceClient* client; |
| 224 WebKit::WebURLRequest request; | 233 WebKit::WebURLRequest request; |
| 225 bool pending_failure_notification; | 234 bool pending_failure_notification; |
| 226 linked_ptr<WebKit::WebURLLoader> loader; | 235 linked_ptr<WebKit::WebURLLoader> loader; |
| 227 }; | 236 }; |
| 228 | 237 |
| 229 // Helper functions | 238 // Helper functions |
| 230 WebPluginResourceClient* GetClientFromLoader(WebKit::WebURLLoader* loader); | 239 WebPluginResourceClient* GetClientFromLoader(WebKit::WebURLLoader* loader); |
| 231 ClientInfo* GetClientInfoFromLoader(WebKit::WebURLLoader* loader); | 240 ClientInfo* GetClientInfoFromLoader(WebKit::WebURLLoader* loader); |
| 232 | 241 |
| 242 // Helper function to set the referrer on the request passed in. |
| 243 void SetReferrer(WebKit::WebURLRequest* request, Referrer referrer_flag); |
| 244 |
| 233 std::vector<ClientInfo> clients_; | 245 std::vector<ClientInfo> clients_; |
| 234 | 246 |
| 235 bool windowless_; | 247 bool windowless_; |
| 236 gfx::PluginWindowHandle window_; | 248 gfx::PluginWindowHandle window_; |
| 237 base::WeakPtr<WebPluginPageDelegate> page_delegate_; | 249 base::WeakPtr<WebPluginPageDelegate> page_delegate_; |
| 238 WebKit::WebFrame* webframe_; | 250 WebKit::WebFrame* webframe_; |
| 239 | 251 |
| 240 WebPluginDelegate* delegate_; | 252 WebPluginDelegate* delegate_; |
| 241 | 253 |
| 242 // This is just a weak reference. | 254 // This is just a weak reference. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 std::vector<std::string> arg_values_; | 286 std::vector<std::string> arg_values_; |
| 275 | 287 |
| 276 ScopedRunnableMethodFactory<WebPluginImpl> method_factory_; | 288 ScopedRunnableMethodFactory<WebPluginImpl> method_factory_; |
| 277 | 289 |
| 278 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); | 290 DISALLOW_COPY_AND_ASSIGN(WebPluginImpl); |
| 279 }; | 291 }; |
| 280 | 292 |
| 281 } // namespace webkit_glue | 293 } // namespace webkit_glue |
| 282 | 294 |
| 283 #endif // #ifndef WEBKIT_GLUE_WEBPLUGIN_IMPL_H_ | 295 #endif // #ifndef WEBKIT_GLUE_WEBPLUGIN_IMPL_H_ |
| OLD | NEW |