OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "core/loader/BeaconLoader.h" | 6 #include "core/loader/BeaconLoader.h" |
7 | 7 |
8 #include "core/FetchInitiatorTypeNames.h" | 8 #include "core/FetchInitiatorTypeNames.h" |
9 #include "core/dom/DOMArrayBufferView.h" | 9 #include "core/dom/DOMArrayBufferView.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 { | 140 { |
141 ASSERT(data); | 141 ASSERT(data); |
142 RefPtr<FormData> entityBody = FormData::create(); | 142 RefPtr<FormData> entityBody = FormData::create(); |
143 if (data->hasBackingFile()) | 143 if (data->hasBackingFile()) |
144 entityBody->appendFile(toFile(data)->path()); | 144 entityBody->appendFile(toFile(data)->path()); |
145 else | 145 else |
146 entityBody->appendBlob(data->uuid(), data->blobDataHandle()); | 146 entityBody->appendBlob(data->uuid(), data->blobDataHandle()); |
147 | 147 |
148 request.setHTTPBody(entityBody.release()); | 148 request.setHTTPBody(entityBody.release()); |
149 | 149 |
150 AtomicString contentType; | |
151 const String& blobType = data->type(); | 150 const String& blobType = data->type(); |
152 if (!blobType.isEmpty() && isValidContentType(blobType)) | 151 if (!blobType.isEmpty() && isValidContentType(blobType)) |
153 request.setHTTPContentType(AtomicString(contentType)); | 152 request.setHTTPContentType(AtomicString(blobType)); |
154 | 153 |
155 return true; | 154 return true; |
156 } | 155 } |
157 | 156 |
158 unsigned long long Beacon::beaconSize(PassRefPtr<DOMArrayBufferView> data) | 157 unsigned long long Beacon::beaconSize(PassRefPtr<DOMArrayBufferView> data) |
159 { | 158 { |
160 return data->byteLength(); | 159 return data->byteLength(); |
161 } | 160 } |
162 | 161 |
163 bool Beacon::serialize(PassRefPtr<DOMArrayBufferView> data, ResourceRequest& req
uest, int, int&) | 162 bool Beacon::serialize(PassRefPtr<DOMArrayBufferView> data, ResourceRequest& req
uest, int, int&) |
(...skipping 27 matching lines...) Expand all Loading... |
191 request.setHTTPBody(entityBody.release()); | 190 request.setHTTPBody(entityBody.release()); |
192 request.setHTTPContentType(contentType); | 191 request.setHTTPContentType(contentType); |
193 | 192 |
194 payloadLength = entitySize; | 193 payloadLength = entitySize; |
195 return true; | 194 return true; |
196 } | 195 } |
197 | 196 |
198 } // namespace | 197 } // namespace |
199 | 198 |
200 } // namespace blink | 199 } // namespace blink |
OLD | NEW |