| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser/loader/upload_data_stream_builder.h" | 5 #include "content/browser/loader/upload_data_stream_builder.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/base/upload_bytes_element_reader.h" | 8 #include "net/base/upload_bytes_element_reader.h" |
| 9 #include "net/base/upload_data_stream.h" | 9 #include "net/base/upload_data_stream.h" |
| 10 #include "net/base/upload_file_element_reader.h" | 10 #include "net/base/upload_file_element_reader.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(FileElementReader); | 64 DISALLOW_COPY_AND_ASSIGN(FileElementReader); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 void ResolveBlobReference( | 67 void ResolveBlobReference( |
| 68 ResourceRequestBody* body, | 68 ResourceRequestBody* body, |
| 69 webkit_blob::BlobStorageContext* blob_context, | 69 webkit_blob::BlobStorageContext* blob_context, |
| 70 const ResourceRequestBody::Element& element, | 70 const ResourceRequestBody::Element& element, |
| 71 std::vector<const ResourceRequestBody::Element*>* resolved_elements) { | 71 std::vector<const ResourceRequestBody::Element*>* resolved_elements) { |
| 72 DCHECK(blob_context); | 72 DCHECK(blob_context); |
| 73 std::string uuid = element.blob_uuid(); | |
| 74 if (uuid.empty()) | |
| 75 uuid = blob_context->LookupUuidFromDeprecatedURL(element.blob_url()); | |
| 76 scoped_ptr<webkit_blob::BlobDataHandle> handle = | 73 scoped_ptr<webkit_blob::BlobDataHandle> handle = |
| 77 blob_context->GetBlobDataFromUUID(uuid); | 74 blob_context->GetBlobDataFromUUID(element.blob_uuid()); |
| 78 DCHECK(handle); | 75 DCHECK(handle); |
| 79 if (!handle) | 76 if (!handle) |
| 80 return; | 77 return; |
| 81 | 78 |
| 82 // If there is no element in the referred blob data, just return. | 79 // If there is no element in the referred blob data, just return. |
| 83 if (handle->data()->items().empty()) | 80 if (handle->data()->items().empty()) |
| 84 return; | 81 return; |
| 85 | 82 |
| 86 // Append the elements in the referenced blob data. | 83 // Append the elements in the referenced blob data. |
| 87 for (size_t i = 0; i < handle->data()->items().size(); ++i) { | 84 for (size_t i = 0; i < handle->data()->items().size(); ++i) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 NOTREACHED(); | 138 NOTREACHED(); |
| 142 break; | 139 break; |
| 143 } | 140 } |
| 144 } | 141 } |
| 145 | 142 |
| 146 return make_scoped_ptr( | 143 return make_scoped_ptr( |
| 147 new net::UploadDataStream(element_readers.Pass(), body->identifier())); | 144 new net::UploadDataStream(element_readers.Pass(), body->identifier())); |
| 148 } | 145 } |
| 149 | 146 |
| 150 } // namespace content | 147 } // namespace content |
| OLD | NEW |