OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #pragma warning(push, 0) | 7 #pragma warning(push, 0) |
8 #include "Document.h" | 8 #include "Document.h" |
9 #include "Element.h" | 9 #include "Element.h" |
10 #include "Event.h" | 10 #include "Event.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 } | 230 } |
231 | 231 |
232 WebCore::Widget* WebPluginImpl::Create(const GURL& url, | 232 WebCore::Widget* WebPluginImpl::Create(const GURL& url, |
233 char** argn, | 233 char** argn, |
234 char** argv, | 234 char** argv, |
235 int argc, | 235 int argc, |
236 WebCore::Element *element, | 236 WebCore::Element *element, |
237 WebFrameImpl *frame, | 237 WebFrameImpl *frame, |
238 WebPluginDelegate* delegate, | 238 WebPluginDelegate* delegate, |
239 bool load_manually) { | 239 bool load_manually) { |
240 WebPluginImpl* webplugin = new WebPluginImpl(element, frame, delegate); | 240 WebPluginImpl* webplugin = new WebPluginImpl(element, frame, delegate, url); |
241 | 241 |
242 if (!delegate->Initialize(url, argn, argv, argc, webplugin, load_manually)) { | 242 if (!delegate->Initialize(url, argn, argv, argc, webplugin, load_manually)) { |
243 delegate->PluginDestroyed(); | 243 delegate->PluginDestroyed(); |
244 delegate = NULL; | 244 delegate = NULL; |
245 delete webplugin; | 245 delete webplugin; |
246 return NULL; | 246 return NULL; |
247 } | 247 } |
248 | 248 |
249 WebPluginContainer* container = new WebPluginContainer(webplugin); | 249 WebPluginContainer* container = new WebPluginContainer(webplugin); |
250 webplugin->SetContainer(container); | 250 webplugin->SetContainer(container); |
251 return container; | 251 return container; |
252 } | 252 } |
253 | 253 |
254 WebPluginImpl::WebPluginImpl(WebCore::Element* element, | 254 WebPluginImpl::WebPluginImpl(WebCore::Element* element, |
255 WebFrameImpl* webframe, | 255 WebFrameImpl* webframe, |
256 WebPluginDelegate* delegate) | 256 WebPluginDelegate* delegate, |
| 257 const GURL& plugin_url) |
257 : element_(element), | 258 : element_(element), |
258 webframe_(webframe), | 259 webframe_(webframe), |
259 delegate_(delegate), | 260 delegate_(delegate), |
260 windowless_(false), | 261 windowless_(false), |
261 window_(NULL), | 262 window_(NULL), |
262 force_geometry_update_(false), | 263 force_geometry_update_(false), |
263 visible_(false), | 264 visible_(false), |
264 widget_(NULL), | 265 widget_(NULL), |
265 received_first_paint_notification_(false) { | 266 received_first_paint_notification_(false), |
| 267 plugin_url_(plugin_url) { |
266 } | 268 } |
267 | 269 |
268 WebPluginImpl::~WebPluginImpl() { | 270 WebPluginImpl::~WebPluginImpl() { |
269 } | 271 } |
270 | 272 |
271 void WebPluginImpl::SetWindow(HWND window, HANDLE pump_messages_event) { | 273 void WebPluginImpl::SetWindow(HWND window, HANDLE pump_messages_event) { |
272 if (window) { | 274 if (window) { |
273 DCHECK(!windowless_); // Make sure not called twice. | 275 DCHECK(!windowless_); // Make sure not called twice. |
274 window_ = window; | 276 window_ = window; |
275 } else { | 277 } else { |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 info.client = client; | 1089 info.client = client; |
1088 info.request.setFrame(frame()); | 1090 info.request.setFrame(frame()); |
1089 info.request.setURL(webkit_glue::GURLToKURL(complete_url_string)); | 1091 info.request.setURL(webkit_glue::GURLToKURL(complete_url_string)); |
1090 info.request.setOriginPid(delegate_->GetProcessId()); | 1092 info.request.setOriginPid(delegate_->GetProcessId()); |
1091 info.request.setResourceType(ResourceType::OBJECT); | 1093 info.request.setResourceType(ResourceType::OBJECT); |
1092 info.request.setHTTPMethod(method); | 1094 info.request.setHTTPMethod(method); |
1093 | 1095 |
1094 if (range_info) | 1096 if (range_info) |
1095 info.request.addHTTPHeaderField("Range", range_info); | 1097 info.request.addHTTPHeaderField("Range", range_info); |
1096 | 1098 |
1097 const WebCore::String& referrer = frame()->loader()->outgoingReferrer(); | 1099 WebCore::String referrer; |
| 1100 // If the plugin is instantiated without a SRC URL, then use the |
| 1101 // containing frame URL as the referrer. |
| 1102 if (plugin_url_.spec().empty()) { |
| 1103 referrer = frame()->loader()->outgoingReferrer(); |
| 1104 } else { |
| 1105 referrer = webkit_glue::StdStringToString(plugin_url_.spec()); |
| 1106 } |
| 1107 |
1098 if (!WebCore::FrameLoader::shouldHideReferrer( | 1108 if (!WebCore::FrameLoader::shouldHideReferrer( |
1099 complete_url_string.spec().c_str(), referrer)) { | 1109 complete_url_string.spec().c_str(), referrer)) { |
1100 info.request.setHTTPReferrer(referrer); | 1110 info.request.setHTTPReferrer(referrer); |
1101 } | 1111 } |
1102 | 1112 |
1103 if (lstrcmpA(method, "POST") == 0) { | 1113 if (lstrcmpA(method, "POST") == 0) { |
1104 // Adds headers or form data to a request. This must be called before | 1114 // Adds headers or form data to a request. This must be called before |
1105 // we initiate the actual request. | 1115 // we initiate the actual request. |
1106 SetPostData(&info.request, buf, buf_len); | 1116 SetPostData(&info.request, buf, buf_len); |
1107 } | 1117 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 | 1159 |
1150 MultiPartResponseClient* multi_part_response_client = | 1160 MultiPartResponseClient* multi_part_response_client = |
1151 new MultiPartResponseClient(client); | 1161 new MultiPartResponseClient(client); |
1152 | 1162 |
1153 MultipartResponseDelegate* multi_part_response_handler = | 1163 MultipartResponseDelegate* multi_part_response_handler = |
1154 new MultipartResponseDelegate(multi_part_response_client, NULL, | 1164 new MultipartResponseDelegate(multi_part_response_client, NULL, |
1155 response, | 1165 response, |
1156 multipart_boundary); | 1166 multipart_boundary); |
1157 multi_part_response_map_[client] = multi_part_response_handler; | 1167 multi_part_response_map_[client] = multi_part_response_handler; |
1158 } | 1168 } |
OLD | NEW |