| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 ResourceResponse::ResourceResponse(const KURL& url, | 104 ResourceResponse::ResourceResponse(const KURL& url, |
| 105 const AtomicString& mimeType, | 105 const AtomicString& mimeType, |
| 106 long long expectedLength, | 106 long long expectedLength, |
| 107 const AtomicString& textEncodingName, | 107 const AtomicString& textEncodingName, |
| 108 const String& filename) | 108 const String& filename) |
| 109 : m_url(url), | 109 : m_url(url), |
| 110 m_mimeType(mimeType), | 110 m_mimeType(mimeType), |
| 111 m_expectedContentLength(expectedLength), | 111 m_expectedContentLength(expectedLength), |
| 112 m_textEncodingName(textEncodingName), | 112 m_textEncodingName(textEncodingName), |
| 113 m_suggestedFilename(filename), | |
| 114 m_httpStatusCode(0), | 113 m_httpStatusCode(0), |
| 115 m_lastModifiedDate(0), | 114 m_lastModifiedDate(0), |
| 116 m_wasCached(false), | 115 m_wasCached(false), |
| 117 m_connectionID(0), | 116 m_connectionID(0), |
| 118 m_connectionReused(false), | 117 m_connectionReused(false), |
| 119 m_isNull(false), | 118 m_isNull(false), |
| 120 m_haveParsedAgeHeader(false), | 119 m_haveParsedAgeHeader(false), |
| 121 m_haveParsedDateHeader(false), | 120 m_haveParsedDateHeader(false), |
| 122 m_haveParsedExpiresHeader(false), | 121 m_haveParsedExpiresHeader(false), |
| 123 m_haveParsedLastModifiedHeader(false), | 122 m_haveParsedLastModifiedHeader(false), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 142 m_encodedDataLength(0), | 141 m_encodedDataLength(0), |
| 143 m_encodedBodyLength(0), | 142 m_encodedBodyLength(0), |
| 144 m_decodedBodyLength(0) {} | 143 m_decodedBodyLength(0) {} |
| 145 | 144 |
| 146 ResourceResponse::ResourceResponse(CrossThreadResourceResponseData* data) | 145 ResourceResponse::ResourceResponse(CrossThreadResourceResponseData* data) |
| 147 : ResourceResponse() { | 146 : ResourceResponse() { |
| 148 setURL(data->m_url); | 147 setURL(data->m_url); |
| 149 setMimeType(AtomicString(data->m_mimeType)); | 148 setMimeType(AtomicString(data->m_mimeType)); |
| 150 setExpectedContentLength(data->m_expectedContentLength); | 149 setExpectedContentLength(data->m_expectedContentLength); |
| 151 setTextEncodingName(AtomicString(data->m_textEncodingName)); | 150 setTextEncodingName(AtomicString(data->m_textEncodingName)); |
| 152 setSuggestedFilename(data->m_suggestedFilename); | |
| 153 | 151 |
| 154 setHTTPStatusCode(data->m_httpStatusCode); | 152 setHTTPStatusCode(data->m_httpStatusCode); |
| 155 setHTTPStatusText(AtomicString(data->m_httpStatusText)); | 153 setHTTPStatusText(AtomicString(data->m_httpStatusText)); |
| 156 | 154 |
| 157 m_httpHeaderFields.adopt(std::move(data->m_httpHeaders)); | 155 m_httpHeaderFields.adopt(std::move(data->m_httpHeaders)); |
| 158 setLastModifiedDate(data->m_lastModifiedDate); | 156 setLastModifiedDate(data->m_lastModifiedDate); |
| 159 setResourceLoadTiming(data->m_resourceLoadTiming.release()); | 157 setResourceLoadTiming(data->m_resourceLoadTiming.release()); |
| 160 m_hasMajorCertificateErrors = data->m_hasMajorCertificateErrors; | 158 m_hasMajorCertificateErrors = data->m_hasMajorCertificateErrors; |
| 161 m_securityStyle = data->m_securityStyle; | 159 m_securityStyle = data->m_securityStyle; |
| 162 m_securityDetails.protocol = data->m_securityDetails.protocol; | 160 m_securityDetails.protocol = data->m_securityDetails.protocol; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 default; | 203 default; |
| 206 | 204 |
| 207 std::unique_ptr<CrossThreadResourceResponseData> ResourceResponse::copyData() | 205 std::unique_ptr<CrossThreadResourceResponseData> ResourceResponse::copyData() |
| 208 const { | 206 const { |
| 209 std::unique_ptr<CrossThreadResourceResponseData> data = | 207 std::unique_ptr<CrossThreadResourceResponseData> data = |
| 210 wrapUnique(new CrossThreadResourceResponseData); | 208 wrapUnique(new CrossThreadResourceResponseData); |
| 211 data->m_url = url().copy(); | 209 data->m_url = url().copy(); |
| 212 data->m_mimeType = mimeType().getString().isolatedCopy(); | 210 data->m_mimeType = mimeType().getString().isolatedCopy(); |
| 213 data->m_expectedContentLength = expectedContentLength(); | 211 data->m_expectedContentLength = expectedContentLength(); |
| 214 data->m_textEncodingName = textEncodingName().getString().isolatedCopy(); | 212 data->m_textEncodingName = textEncodingName().getString().isolatedCopy(); |
| 215 data->m_suggestedFilename = suggestedFilename().isolatedCopy(); | |
| 216 data->m_httpStatusCode = httpStatusCode(); | 213 data->m_httpStatusCode = httpStatusCode(); |
| 217 data->m_httpStatusText = httpStatusText().getString().isolatedCopy(); | 214 data->m_httpStatusText = httpStatusText().getString().isolatedCopy(); |
| 218 data->m_httpHeaders = httpHeaderFields().copyData(); | 215 data->m_httpHeaders = httpHeaderFields().copyData(); |
| 219 data->m_lastModifiedDate = lastModifiedDate(); | 216 data->m_lastModifiedDate = lastModifiedDate(); |
| 220 if (m_resourceLoadTiming) | 217 if (m_resourceLoadTiming) |
| 221 data->m_resourceLoadTiming = m_resourceLoadTiming->deepCopy(); | 218 data->m_resourceLoadTiming = m_resourceLoadTiming->deepCopy(); |
| 222 data->m_hasMajorCertificateErrors = m_hasMajorCertificateErrors; | 219 data->m_hasMajorCertificateErrors = m_hasMajorCertificateErrors; |
| 223 data->m_securityStyle = m_securityStyle; | 220 data->m_securityStyle = m_securityStyle; |
| 224 data->m_securityDetails.protocol = m_securityDetails.protocol.isolatedCopy(); | 221 data->m_securityDetails.protocol = m_securityDetails.protocol.isolatedCopy(); |
| 225 data->m_securityDetails.cipher = m_securityDetails.cipher.isolatedCopy(); | 222 data->m_securityDetails.cipher = m_securityDetails.cipher.isolatedCopy(); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 } | 309 } |
| 313 | 310 |
| 314 void ResourceResponse::setTextEncodingName(const AtomicString& encodingName) { | 311 void ResourceResponse::setTextEncodingName(const AtomicString& encodingName) { |
| 315 m_isNull = false; | 312 m_isNull = false; |
| 316 | 313 |
| 317 // FIXME: Text encoding is determined by HTTP Content-Type header. We should | 314 // FIXME: Text encoding is determined by HTTP Content-Type header. We should |
| 318 // update the header, so that it doesn't disagree with m_textEncodingName. | 315 // update the header, so that it doesn't disagree with m_textEncodingName. |
| 319 m_textEncodingName = encodingName; | 316 m_textEncodingName = encodingName; |
| 320 } | 317 } |
| 321 | 318 |
| 322 // FIXME should compute this on the fly | |
| 323 const String& ResourceResponse::suggestedFilename() const { | |
| 324 return m_suggestedFilename; | |
| 325 } | |
| 326 | |
| 327 void ResourceResponse::setSuggestedFilename(const String& suggestedName) { | |
| 328 m_isNull = false; | |
| 329 | |
| 330 // FIXME: Suggested file name is calculated based on other headers. There | |
| 331 // should not be a setter for it. | |
| 332 m_suggestedFilename = suggestedName; | |
| 333 } | |
| 334 | |
| 335 int ResourceResponse::httpStatusCode() const { | 319 int ResourceResponse::httpStatusCode() const { |
| 336 return m_httpStatusCode; | 320 return m_httpStatusCode; |
| 337 } | 321 } |
| 338 | 322 |
| 339 void ResourceResponse::setHTTPStatusCode(int statusCode) { | 323 void ResourceResponse::setHTTPStatusCode(int statusCode) { |
| 340 m_httpStatusCode = statusCode; | 324 m_httpStatusCode = statusCode; |
| 341 } | 325 } |
| 342 | 326 |
| 343 const AtomicString& ResourceResponse::httpStatusText() const { | 327 const AtomicString& ResourceResponse::httpStatusText() const { |
| 344 return m_httpStatusText; | 328 return m_httpStatusText; |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 if (a.isNull() != b.isNull()) | 617 if (a.isNull() != b.isNull()) |
| 634 return false; | 618 return false; |
| 635 if (a.url() != b.url()) | 619 if (a.url() != b.url()) |
| 636 return false; | 620 return false; |
| 637 if (a.mimeType() != b.mimeType()) | 621 if (a.mimeType() != b.mimeType()) |
| 638 return false; | 622 return false; |
| 639 if (a.expectedContentLength() != b.expectedContentLength()) | 623 if (a.expectedContentLength() != b.expectedContentLength()) |
| 640 return false; | 624 return false; |
| 641 if (a.textEncodingName() != b.textEncodingName()) | 625 if (a.textEncodingName() != b.textEncodingName()) |
| 642 return false; | 626 return false; |
| 643 if (a.suggestedFilename() != b.suggestedFilename()) | |
| 644 return false; | |
| 645 if (a.httpStatusCode() != b.httpStatusCode()) | 627 if (a.httpStatusCode() != b.httpStatusCode()) |
| 646 return false; | 628 return false; |
| 647 if (a.httpStatusText() != b.httpStatusText()) | 629 if (a.httpStatusText() != b.httpStatusText()) |
| 648 return false; | 630 return false; |
| 649 if (a.httpHeaderFields() != b.httpHeaderFields()) | 631 if (a.httpHeaderFields() != b.httpHeaderFields()) |
| 650 return false; | 632 return false; |
| 651 if (a.resourceLoadTiming() && b.resourceLoadTiming() && | 633 if (a.resourceLoadTiming() && b.resourceLoadTiming() && |
| 652 *a.resourceLoadTiming() == *b.resourceLoadTiming()) | 634 *a.resourceLoadTiming() == *b.resourceLoadTiming()) |
| 653 return true; | 635 return true; |
| 654 if (a.resourceLoadTiming() != b.resourceLoadTiming()) | 636 if (a.resourceLoadTiming() != b.resourceLoadTiming()) |
| 655 return false; | 637 return false; |
| 656 if (a.encodedBodyLength() != b.encodedBodyLength()) | 638 if (a.encodedBodyLength() != b.encodedBodyLength()) |
| 657 return false; | 639 return false; |
| 658 if (a.decodedBodyLength() != b.decodedBodyLength()) | 640 if (a.decodedBodyLength() != b.decodedBodyLength()) |
| 659 return false; | 641 return false; |
| 660 return true; | 642 return true; |
| 661 } | 643 } |
| 662 | 644 |
| 663 } // namespace blink | 645 } // namespace blink |
| OLD | NEW |