| 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/webplugin.h" |
| 9 #include "content/child/npapi/plugin_host.h" | 10 #include "content/child/npapi/plugin_host.h" |
| 10 #include "content/child/npapi/plugin_instance.h" | 11 #include "content/child/npapi/plugin_instance.h" |
| 11 #include "content/child/npapi/plugin_stream_url.h" | 12 #include "content/child/npapi/plugin_stream_url.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/resource_dispatcher.h" | 16 #include "content/child/resource_dispatcher.h" |
| 17 #include "content/child/web_url_loader_impl.h" | |
| 18 #include "net/base/load_flags.h" | 17 #include "net/base/load_flags.h" |
| 19 #include "net/base/net_errors.h" | 18 #include "net/base/net_errors.h" |
| 20 #include "net/http/http_response_headers.h" | 19 #include "net/http/http_response_headers.h" |
| 21 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" | 20 #include "third_party/WebKit/public/platform/WebURLLoaderClient.h" |
| 22 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 21 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 23 #include "webkit/child/multipart_response_delegate.h" | 22 #include "webkit/child/multipart_response_delegate.h" |
| 23 #include "webkit/child/weburlloader_impl.h" |
| 24 #include "webkit/common/resource_request_body.h" | 24 #include "webkit/common/resource_request_body.h" |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 namespace { | 27 namespace { |
| 28 | 28 |
| 29 // This class handles individual multipart responses. It is instantiated when | 29 // This class handles individual multipart responses. It is instantiated when |
| 30 // we receive HTTP status code 206 in the HTTP response. This indicates | 30 // we receive HTTP status code 206 in the HTTP response. This indicates |
| 31 // that the response could have multiple parts each separated by a boundary | 31 // that the response could have multiple parts each separated by a boundary |
| 32 // specified in the response header. | 32 // specified in the response header. |
| 33 // TODO(jam): this is similar to MultiPartResponseClient in webplugin_impl.cc, | 33 // TODO(jam): this is similar to MultiPartResponseClient in webplugin_impl.cc, |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 // GetAllHeaders, and GetResponseInfo until kDirectNPAPIRequests is the | 229 // GetAllHeaders, and GetResponseInfo until kDirectNPAPIRequests is the |
| 230 // default and we can remove the old path there. | 230 // default and we can remove the old path there. |
| 231 | 231 |
| 232 bool request_is_seekable = true; | 232 bool request_is_seekable = true; |
| 233 DCHECK(!multipart_delegate_.get()); | 233 DCHECK(!multipart_delegate_.get()); |
| 234 if (plugin_stream_->seekable()) { | 234 if (plugin_stream_->seekable()) { |
| 235 int response_code = info.headers->response_code(); | 235 int response_code = info.headers->response_code(); |
| 236 if (response_code == 206) { | 236 if (response_code == 206) { |
| 237 blink::WebURLResponse response; | 237 blink::WebURLResponse response; |
| 238 response.initialize(); | 238 response.initialize(); |
| 239 WebURLLoaderImpl::PopulateURLResponse(url_, info, &response); | 239 webkit_glue::WebURLLoaderImpl::PopulateURLResponse(url_, info, &response); |
| 240 | 240 |
| 241 std::string multipart_boundary; | 241 std::string multipart_boundary; |
| 242 if (webkit_glue::MultipartResponseDelegate::ReadMultipartBoundary( | 242 if (webkit_glue::MultipartResponseDelegate::ReadMultipartBoundary( |
| 243 response, &multipart_boundary)) { | 243 response, &multipart_boundary)) { |
| 244 plugin_stream_->instance()->webplugin()->DidStartLoading(); | 244 plugin_stream_->instance()->webplugin()->DidStartLoading(); |
| 245 | 245 |
| 246 MultiPartResponseClient* multi_part_response_client = | 246 MultiPartResponseClient* multi_part_response_client = |
| 247 new MultiPartResponseClient(plugin_stream_); | 247 new MultiPartResponseClient(plugin_stream_); |
| 248 | 248 |
| 249 multipart_delegate_.reset(new webkit_glue::MultipartResponseDelegate( | 249 multipart_delegate_.reset(new webkit_glue::MultipartResponseDelegate( |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 } | 350 } |
| 351 | 351 |
| 352 if (error_code == net::OK) { | 352 if (error_code == net::OK) { |
| 353 plugin_stream_->DidFinishLoading(resource_id_); | 353 plugin_stream_->DidFinishLoading(resource_id_); |
| 354 } else { | 354 } else { |
| 355 plugin_stream_->DidFail(resource_id_); | 355 plugin_stream_->DidFail(resource_id_); |
| 356 } | 356 } |
| 357 } | 357 } |
| 358 | 358 |
| 359 } // namespace content | 359 } // namespace content |
| OLD | NEW |