OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/loader/certificate_resource_handler.h" | 5 #include "content/browser/loader/certificate_resource_handler.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "content/browser/loader/resource_request_info_impl.h" | 8 #include "content/browser/loader/resource_request_info_impl.h" |
9 #include "content/public/browser/content_browser_client.h" | 9 #include "content/public/browser/content_browser_client.h" |
10 #include "content/public/common/resource_response.h" | 10 #include "content/public/common/resource_response.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 AssembleResource(); | 100 AssembleResource(); |
101 | 101 |
102 const void* content_bytes = NULL; | 102 const void* content_bytes = NULL; |
103 if (resource_buffer_.get()) | 103 if (resource_buffer_.get()) |
104 content_bytes = resource_buffer_->data(); | 104 content_bytes = resource_buffer_->data(); |
105 | 105 |
106 // Note that it's up to the browser to verify that the certificate | 106 // Note that it's up to the browser to verify that the certificate |
107 // data is well-formed. | 107 // data is well-formed. |
108 const ResourceRequestInfo* info = GetRequestInfo(); | 108 const ResourceRequestInfo* info = GetRequestInfo(); |
109 GetContentClient()->browser()->AddCertificate( | 109 GetContentClient()->browser()->AddCertificate( |
110 request(), cert_type_, content_bytes, content_length_, | 110 cert_type_, content_bytes, content_length_, |
111 info->GetChildID(), info->GetRouteID()); | 111 info->GetChildID(), info->GetRenderFrameID()); |
112 } | 112 } |
113 | 113 |
114 void CertificateResourceHandler::AssembleResource() { | 114 void CertificateResourceHandler::AssembleResource() { |
115 // 0-length IOBuffers are not allowed. | 115 // 0-length IOBuffers are not allowed. |
116 if (content_length_ == 0) { | 116 if (content_length_ == 0) { |
117 resource_buffer_ = NULL; | 117 resource_buffer_ = NULL; |
118 return; | 118 return; |
119 } | 119 } |
120 | 120 |
121 // Create the new buffer. | 121 // Create the new buffer. |
(...skipping 10 matching lines...) Expand all Loading... |
132 bytes_copied += data_len; | 132 bytes_copied += data_len; |
133 } | 133 } |
134 DCHECK_EQ(content_length_, bytes_copied); | 134 DCHECK_EQ(content_length_, bytes_copied); |
135 } | 135 } |
136 | 136 |
137 void CertificateResourceHandler::OnDataDownloaded(int bytes_downloaded) { | 137 void CertificateResourceHandler::OnDataDownloaded(int bytes_downloaded) { |
138 NOTREACHED(); | 138 NOTREACHED(); |
139 } | 139 } |
140 | 140 |
141 } // namespace content | 141 } // namespace content |
OLD | NEW |