| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 WebHTTPLoadInfo::WebHTTPLoadInfo(WTF::PassRefPtr<ResourceLoadInfo> value) | 51 WebHTTPLoadInfo::WebHTTPLoadInfo(WTF::PassRefPtr<ResourceLoadInfo> value) |
| 52 : private_(value) {} | 52 : private_(value) {} |
| 53 | 53 |
| 54 WebHTTPLoadInfo::operator WTF::PassRefPtr<ResourceLoadInfo>() const { | 54 WebHTTPLoadInfo::operator WTF::PassRefPtr<ResourceLoadInfo>() const { |
| 55 return private_.Get(); | 55 return private_.Get(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 int WebHTTPLoadInfo::HttpStatusCode() const { | 58 int WebHTTPLoadInfo::HttpStatusCode() const { |
| 59 ASSERT(!private_.IsNull()); | 59 DCHECK(!private_.IsNull()); |
| 60 return private_->http_status_code; | 60 return private_->http_status_code; |
| 61 } | 61 } |
| 62 | 62 |
| 63 void WebHTTPLoadInfo::SetHTTPStatusCode(int status_code) { | 63 void WebHTTPLoadInfo::SetHTTPStatusCode(int status_code) { |
| 64 ASSERT(!private_.IsNull()); | 64 DCHECK(!private_.IsNull()); |
| 65 private_->http_status_code = status_code; | 65 private_->http_status_code = status_code; |
| 66 } | 66 } |
| 67 | 67 |
| 68 WebString WebHTTPLoadInfo::HttpStatusText() const { | 68 WebString WebHTTPLoadInfo::HttpStatusText() const { |
| 69 ASSERT(!private_.IsNull()); | 69 DCHECK(!private_.IsNull()); |
| 70 return private_->http_status_text; | 70 return private_->http_status_text; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void WebHTTPLoadInfo::SetHTTPStatusText(const WebString& status_text) { | 73 void WebHTTPLoadInfo::SetHTTPStatusText(const WebString& status_text) { |
| 74 ASSERT(!private_.IsNull()); | 74 DCHECK(!private_.IsNull()); |
| 75 private_->http_status_text = status_text; | 75 private_->http_status_text = status_text; |
| 76 } | 76 } |
| 77 | 77 |
| 78 static void AddHeader(HTTPHeaderMap* map, | 78 static void AddHeader(HTTPHeaderMap* map, |
| 79 const WebString& name, | 79 const WebString& name, |
| 80 const WebString& value) { | 80 const WebString& value) { |
| 81 HTTPHeaderMap::AddResult result = map->Add(name, value); | 81 HTTPHeaderMap::AddResult result = map->Add(name, value); |
| 82 // It is important that values are separated by '\n', not comma, otherwise | 82 // It is important that values are separated by '\n', not comma, otherwise |
| 83 // Set-Cookie header is not parseable. | 83 // Set-Cookie header is not parseable. |
| 84 if (!result.is_new_entry) | 84 if (!result.is_new_entry) |
| 85 result.stored_value->value = | 85 result.stored_value->value = |
| 86 result.stored_value->value + "\n" + String(value); | 86 result.stored_value->value + "\n" + String(value); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void WebHTTPLoadInfo::AddRequestHeader(const WebString& name, | 89 void WebHTTPLoadInfo::AddRequestHeader(const WebString& name, |
| 90 const WebString& value) { | 90 const WebString& value) { |
| 91 ASSERT(!private_.IsNull()); | 91 DCHECK(!private_.IsNull()); |
| 92 AddHeader(&private_->request_headers, name, value); | 92 AddHeader(&private_->request_headers, name, value); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void WebHTTPLoadInfo::AddResponseHeader(const WebString& name, | 95 void WebHTTPLoadInfo::AddResponseHeader(const WebString& name, |
| 96 const WebString& value) { | 96 const WebString& value) { |
| 97 ASSERT(!private_.IsNull()); | 97 DCHECK(!private_.IsNull()); |
| 98 AddHeader(&private_->response_headers, name, value); | 98 AddHeader(&private_->response_headers, name, value); |
| 99 } | 99 } |
| 100 | 100 |
| 101 WebString WebHTTPLoadInfo::RequestHeadersText() const { | 101 WebString WebHTTPLoadInfo::RequestHeadersText() const { |
| 102 ASSERT(!private_.IsNull()); | 102 DCHECK(!private_.IsNull()); |
| 103 return private_->request_headers_text; | 103 return private_->request_headers_text; |
| 104 } | 104 } |
| 105 | 105 |
| 106 void WebHTTPLoadInfo::SetRequestHeadersText(const WebString& headers_text) { | 106 void WebHTTPLoadInfo::SetRequestHeadersText(const WebString& headers_text) { |
| 107 ASSERT(!private_.IsNull()); | 107 DCHECK(!private_.IsNull()); |
| 108 private_->request_headers_text = headers_text; | 108 private_->request_headers_text = headers_text; |
| 109 } | 109 } |
| 110 | 110 |
| 111 WebString WebHTTPLoadInfo::ResponseHeadersText() const { | 111 WebString WebHTTPLoadInfo::ResponseHeadersText() const { |
| 112 ASSERT(!private_.IsNull()); | 112 DCHECK(!private_.IsNull()); |
| 113 return private_->response_headers_text; | 113 return private_->response_headers_text; |
| 114 } | 114 } |
| 115 | 115 |
| 116 void WebHTTPLoadInfo::SetResponseHeadersText(const WebString& headers_text) { | 116 void WebHTTPLoadInfo::SetResponseHeadersText(const WebString& headers_text) { |
| 117 ASSERT(!private_.IsNull()); | 117 DCHECK(!private_.IsNull()); |
| 118 private_->response_headers_text = headers_text; | 118 private_->response_headers_text = headers_text; |
| 119 } | 119 } |
| 120 | 120 |
| 121 WebString WebHTTPLoadInfo::NpnNegotiatedProtocol() const { | 121 WebString WebHTTPLoadInfo::NpnNegotiatedProtocol() const { |
| 122 ASSERT(!private_.IsNull()); | 122 DCHECK(!private_.IsNull()); |
| 123 return private_->npn_negotiated_protocol; | 123 return private_->npn_negotiated_protocol; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void WebHTTPLoadInfo::SetNPNNegotiatedProtocol( | 126 void WebHTTPLoadInfo::SetNPNNegotiatedProtocol( |
| 127 const WebString& npn_negotiated_protocol) { | 127 const WebString& npn_negotiated_protocol) { |
| 128 ASSERT(!private_.IsNull()); | 128 DCHECK(!private_.IsNull()); |
| 129 private_->npn_negotiated_protocol = npn_negotiated_protocol; | 129 private_->npn_negotiated_protocol = npn_negotiated_protocol; |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace blink | 132 } // namespace blink |
| OLD | NEW |