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 "modules/fetch/FetchRequestData.h" | 5 #include "modules/fetch/FetchRequestData.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptState.h" | 7 #include "bindings/core/v8/ScriptState.h" |
8 #include "core/dom/ExecutionContext.h" | 8 #include "core/dom/ExecutionContext.h" |
9 #include "core/loader/ThreadableLoader.h" | 9 #include "core/loader/ThreadableLoader.h" |
10 #include "modules/credentialmanager/PasswordCredential.h" | 10 #include "modules/credentialmanager/PasswordCredential.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 ScriptState* scriptState, | 28 ScriptState* scriptState, |
29 const WebServiceWorkerRequest& webRequest) { | 29 const WebServiceWorkerRequest& webRequest) { |
30 FetchRequestData* request = FetchRequestData::create(); | 30 FetchRequestData* request = FetchRequestData::create(); |
31 request->m_url = webRequest.url(); | 31 request->m_url = webRequest.url(); |
32 request->m_method = webRequest.method(); | 32 request->m_method = webRequest.method(); |
33 for (HTTPHeaderMap::const_iterator it = webRequest.headers().begin(); | 33 for (HTTPHeaderMap::const_iterator it = webRequest.headers().begin(); |
34 it != webRequest.headers().end(); ++it) | 34 it != webRequest.headers().end(); ++it) |
35 request->m_headerList->append(it->key, it->value); | 35 request->m_headerList->append(it->key, it->value); |
36 if (webRequest.blobDataHandle()) | 36 if (webRequest.blobDataHandle()) |
37 request->setBuffer(new BodyStreamBuffer( | 37 request->setBuffer(new BodyStreamBuffer( |
38 scriptState, new BlobBytesConsumer(scriptState->getExecutionContext(), | 38 scriptState, |
39 webRequest.blobDataHandle()))); | 39 new BlobBytesConsumer(scriptState->getExecutionContext(), |
| 40 webRequest.blobDataHandle()))); |
40 request->setContext(webRequest.requestContext()); | 41 request->setContext(webRequest.requestContext()); |
41 request->setReferrer( | 42 request->setReferrer( |
42 Referrer(webRequest.referrerUrl().string(), | 43 Referrer(webRequest.referrerUrl().string(), |
43 static_cast<ReferrerPolicy>(webRequest.getReferrerPolicy()))); | 44 static_cast<ReferrerPolicy>(webRequest.getReferrerPolicy()))); |
44 request->setMode(webRequest.mode()); | 45 request->setMode(webRequest.mode()); |
45 request->setCredentials(webRequest.credentialsMode()); | 46 request->setCredentials(webRequest.credentialsMode()); |
46 request->setRedirect(webRequest.redirectMode()); | 47 request->setRedirect(webRequest.redirectMode()); |
47 request->setMIMEType(request->m_headerList->extractMIMEType()); | 48 request->setMIMEType(request->m_headerList->extractMIMEType()); |
48 return request; | 49 return request; |
49 } | 50 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 if (m_credentials != WebURLRequest::FetchCredentialsModePassword) | 111 if (m_credentials != WebURLRequest::FetchCredentialsModePassword) |
111 m_attachedCredential.clear(); | 112 m_attachedCredential.clear(); |
112 } | 113 } |
113 | 114 |
114 DEFINE_TRACE(FetchRequestData) { | 115 DEFINE_TRACE(FetchRequestData) { |
115 visitor->trace(m_buffer); | 116 visitor->trace(m_buffer); |
116 visitor->trace(m_headerList); | 117 visitor->trace(m_headerList); |
117 } | 118 } |
118 | 119 |
119 } // namespace blink | 120 } // namespace blink |
OLD | NEW |