OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/child/npapi/plugin_url_fetcher.h" | 5 #include "content/child/npapi/plugin_url_fetcher.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "content/child/child_thread.h" | 8 #include "content/child/child_thread.h" |
9 #include "content/child/npapi/plugin_host.h" | 9 #include "content/child/npapi/plugin_host.h" |
10 #include "content/child/npapi/plugin_instance.h" | 10 #include "content/child/npapi/plugin_instance.h" |
11 #include "content/child/npapi/plugin_stream_url.h" | 11 #include "content/child/npapi/plugin_stream_url.h" |
12 #include "content/child/npapi/webplugin.h" | 12 #include "content/child/npapi/webplugin.h" |
13 #include "content/child/npapi/webplugin_resource_client.h" | 13 #include "content/child/npapi/webplugin_resource_client.h" |
14 #include "content/child/plugin_messages.h" | 14 #include "content/child/plugin_messages.h" |
15 #include "content/child/request_extra_data.h" | 15 #include "content/child/request_extra_data.h" |
16 #include "content/child/request_info.h" | 16 #include "content/child/request_info.h" |
17 #include "content/child/resource_dispatcher.h" | 17 #include "content/child/resource_dispatcher.h" |
18 #include "content/child/web_url_loader_impl.h" | 18 #include "content/child/web_url_loader_impl.h" |
19 #include "content/common/resource_request_body.h" | 19 #include "content/common/resource_request_body.h" |
20 #include "content/common/service_worker/service_worker_types.h" | 20 #include "content/common/service_worker/service_worker_types.h" |
| 21 #include "content/public/common/resource_response_info.h" |
21 #include "net/base/load_flags.h" | 22 #include "net/base/load_flags.h" |
22 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
23 #include "net/http/http_response_headers.h" | 24 #include "net/http/http_response_headers.h" |
24 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 25 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
25 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 26 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
26 #include "webkit/child/multipart_response_delegate.h" | 27 #include "webkit/child/multipart_response_delegate.h" |
27 #include "webkit/child/resource_loader_bridge.h" | 28 #include "webkit/child/resource_loader_bridge.h" |
28 #include "webkit/common/resource_response_info.h" | |
29 | 29 |
30 namespace content { | 30 namespace content { |
31 namespace { | 31 namespace { |
32 | 32 |
33 // This class handles individual multipart responses. It is instantiated when | 33 // This class handles individual multipart responses. It is instantiated when |
34 // we receive HTTP status code 206 in the HTTP response. This indicates | 34 // we receive HTTP status code 206 in the HTTP response. This indicates |
35 // that the response could have multiple parts each separated by a boundary | 35 // that the response could have multiple parts each separated by a boundary |
36 // specified in the response header. | 36 // specified in the response header. |
37 // TODO(jam): this is similar to MultiPartResponseClient in webplugin_impl.cc, | 37 // TODO(jam): this is similar to MultiPartResponseClient in webplugin_impl.cc, |
38 // we should remove that other class once we switch to loading from the plugin | 38 // we should remove that other class once we switch to loading from the plugin |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 plugin_stream_->DidFail(resource_id_); // That will delete |this|. | 184 plugin_stream_->DidFail(resource_id_); // That will delete |this|. |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 void PluginURLFetcher::OnUploadProgress(uint64 position, uint64 size) { | 188 void PluginURLFetcher::OnUploadProgress(uint64 position, uint64 size) { |
189 } | 189 } |
190 | 190 |
191 bool PluginURLFetcher::OnReceivedRedirect( | 191 bool PluginURLFetcher::OnReceivedRedirect( |
192 const GURL& new_url, | 192 const GURL& new_url, |
193 const GURL& new_first_party_for_cookies, | 193 const GURL& new_first_party_for_cookies, |
194 const webkit_glue::ResourceResponseInfo& info) { | 194 const ResourceResponseInfo& info) { |
195 if (!plugin_stream_) | 195 if (!plugin_stream_) |
196 return false; | 196 return false; |
197 | 197 |
198 // TODO(jam): THIS LOGIC IS COPIED FROM WebPluginImpl::willSendRequest until | 198 // TODO(jam): THIS LOGIC IS COPIED FROM WebPluginImpl::willSendRequest until |
199 // kDirectNPAPIRequests is the default and we can remove the old path there. | 199 // kDirectNPAPIRequests is the default and we can remove the old path there. |
200 | 200 |
201 // Currently this check is just to catch an https -> http redirect when | 201 // Currently this check is just to catch an https -> http redirect when |
202 // loading the main plugin src URL. Longer term, we could investigate | 202 // loading the main plugin src URL. Longer term, we could investigate |
203 // firing mixed diplay or scripting issues for subresource loads | 203 // firing mixed diplay or scripting issues for subresource loads |
204 // initiated by plug-ins. | 204 // initiated by plug-ins. |
(...skipping 24 matching lines...) Expand all Loading... |
229 } | 229 } |
230 } else { | 230 } else { |
231 // Pause the request while we ask the plugin what to do about the redirect. | 231 // Pause the request while we ask the plugin what to do about the redirect. |
232 bridge_->SetDefersLoading(true); | 232 bridge_->SetDefersLoading(true); |
233 plugin_stream_->WillSendRequest(url_, response_code); | 233 plugin_stream_->WillSendRequest(url_, response_code); |
234 } | 234 } |
235 | 235 |
236 return true; | 236 return true; |
237 } | 237 } |
238 | 238 |
239 void PluginURLFetcher::OnReceivedResponse( | 239 void PluginURLFetcher::OnReceivedResponse(const ResourceResponseInfo& info) { |
240 const webkit_glue::ResourceResponseInfo& info) { | |
241 if (!plugin_stream_) | 240 if (!plugin_stream_) |
242 return; | 241 return; |
243 | 242 |
244 // TODO(jam): THIS LOGIC IS COPIED FROM WebPluginImpl::didReceiveResponse | 243 // TODO(jam): THIS LOGIC IS COPIED FROM WebPluginImpl::didReceiveResponse |
245 // GetAllHeaders, and GetResponseInfo until kDirectNPAPIRequests is the | 244 // GetAllHeaders, and GetResponseInfo until kDirectNPAPIRequests is the |
246 // default and we can remove the old path there. | 245 // default and we can remove the old path there. |
247 | 246 |
248 bool request_is_seekable = true; | 247 bool request_is_seekable = true; |
249 DCHECK(!multipart_delegate_.get()); | 248 DCHECK(!multipart_delegate_.get()); |
250 if (plugin_stream_->seekable()) { | 249 if (plugin_stream_->seekable()) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 } | 371 } |
373 | 372 |
374 if (error_code == net::OK) { | 373 if (error_code == net::OK) { |
375 plugin_stream_->DidFinishLoading(resource_id_); | 374 plugin_stream_->DidFinishLoading(resource_id_); |
376 } else { | 375 } else { |
377 plugin_stream_->DidFail(resource_id_); | 376 plugin_stream_->DidFail(resource_id_); |
378 } | 377 } |
379 } | 378 } |
380 | 379 |
381 } // namespace content | 380 } // namespace content |
OLD | NEW |