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 "Response.h" | 6 #include "Response.h" |
7 | 7 |
8 #include "bindings/v8/Dictionary.h" | 8 #include "bindings/v8/Dictionary.h" |
9 #include "core/fileapi/Blob.h" | 9 #include "core/fileapi/Blob.h" |
10 #include "modules/serviceworkers/ResponseInit.h" | 10 #include "modules/serviceworkers/ResponseInit.h" |
11 #include "platform/NotImplemented.h" | 11 #include "platform/NotImplemented.h" |
12 #include "public/platform/WebServiceWorkerResponse.h" | 12 #include "public/platform/WebServiceWorkerResponse.h" |
13 | 13 |
14 namespace WebCore { | 14 namespace WebCore { |
15 | 15 |
16 // FIXME: Remove this legacy function when the required Chromium-side patch land
s. | |
17 PassRefPtr<Response> Response::create(const Dictionary& responseInit) | |
18 { | |
19 return create(nullptr, responseInit); | |
20 } | |
21 | |
22 PassRefPtr<Response> Response::create(Blob* body, const Dictionary& responseInit
) | 16 PassRefPtr<Response> Response::create(Blob* body, const Dictionary& responseInit
) |
23 { | 17 { |
24 RefPtr<BlobDataHandle> blobDataHandle = body ? body->blobDataHandle() : null
ptr; | 18 RefPtr<BlobDataHandle> blobDataHandle = body ? body->blobDataHandle() : null
ptr; |
25 | 19 |
26 // FIXME: Maybe append or override content-length and content-type headers u
sing the blob. The spec will clarify what to do: | 20 // FIXME: Maybe append or override content-length and content-type headers u
sing the blob. The spec will clarify what to do: |
27 // https://github.com/slightlyoff/ServiceWorker/issues/192 | 21 // https://github.com/slightlyoff/ServiceWorker/issues/192 |
28 return adoptRef(new Response(blobDataHandle.release(), ResponseInit(response
Init))); | 22 return adoptRef(new Response(blobDataHandle.release(), ResponseInit(response
Init))); |
29 } | 23 } |
30 | 24 |
31 PassRefPtr<HeaderMap> Response::headers() const | 25 PassRefPtr<HeaderMap> Response::headers() const |
(...skipping 16 matching lines...) Expand all Loading... |
48 , m_headers(responseInit.headers) | 42 , m_headers(responseInit.headers) |
49 , m_blobDataHandle(blobDataHandle) | 43 , m_blobDataHandle(blobDataHandle) |
50 { | 44 { |
51 ScriptWrappable::init(this); | 45 ScriptWrappable::init(this); |
52 | 46 |
53 if (!m_headers) | 47 if (!m_headers) |
54 m_headers = HeaderMap::create(); | 48 m_headers = HeaderMap::create(); |
55 } | 49 } |
56 | 50 |
57 } // namespace WebCore | 51 } // namespace WebCore |
OLD | NEW |