Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading |
| 6 | 6 |
| 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 7 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1154 | 1154 |
| 1155 bool ResourceDispatcherHost::CompleteResponseStarted(net::URLRequest* request) { | 1155 bool ResourceDispatcherHost::CompleteResponseStarted(net::URLRequest* request) { |
| 1156 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); | 1156 ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); |
| 1157 | 1157 |
| 1158 scoped_refptr<ResourceResponse> response(new ResourceResponse); | 1158 scoped_refptr<ResourceResponse> response(new ResourceResponse); |
| 1159 PopulateResourceResponse(request, | 1159 PopulateResourceResponse(request, |
| 1160 info->replace_extension_localization_templates(), response); | 1160 info->replace_extension_localization_templates(), response); |
| 1161 | 1161 |
| 1162 if (request->ssl_info().cert) { | 1162 if (request->ssl_info().cert) { |
| 1163 int cert_id = | 1163 int cert_id = |
| 1164 CertStore::GetSharedInstance()->StoreCert(request->ssl_info().cert, | 1164 CertStore::GetInstance()->StoreCert(request->ssl_info().cert, |
| 1165 info->child_id()); | 1165 info->child_id()); |
|
Nico
2010/12/12 23:42:47
indent
Satish
2010/12/13 08:16:30
Done.
| |
| 1166 response->response_head.security_info = | 1166 response->response_head.security_info = |
| 1167 SSLManager::SerializeSecurityInfo( | 1167 SSLManager::SerializeSecurityInfo( |
| 1168 cert_id, request->ssl_info().cert_status, | 1168 cert_id, request->ssl_info().cert_status, |
| 1169 request->ssl_info().security_bits, | 1169 request->ssl_info().security_bits, |
| 1170 request->ssl_info().connection_status); | 1170 request->ssl_info().connection_status); |
| 1171 } else { | 1171 } else { |
| 1172 // We should not have any SSL state. | 1172 // We should not have any SSL state. |
| 1173 DCHECK(!request->ssl_info().cert_status && | 1173 DCHECK(!request->ssl_info().cert_status && |
| 1174 request->ssl_info().security_bits == -1 && | 1174 request->ssl_info().security_bits == -1 && |
| 1175 !request->ssl_info().connection_status); | 1175 !request->ssl_info().connection_status); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1493 if (!request->status().is_success() && | 1493 if (!request->status().is_success() && |
| 1494 info->resource_type() == ResourceType::MAIN_FRAME) { | 1494 info->resource_type() == ResourceType::MAIN_FRAME) { |
| 1495 UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.ErrorCodesForMainFrame", | 1495 UMA_HISTOGRAM_CUSTOM_ENUMERATION("Net.ErrorCodesForMainFrame", |
| 1496 -request->status().os_error(), | 1496 -request->status().os_error(), |
| 1497 GetAllNetErrorCodes()); | 1497 GetAllNetErrorCodes()); |
| 1498 } | 1498 } |
| 1499 | 1499 |
| 1500 std::string security_info; | 1500 std::string security_info; |
| 1501 const net::SSLInfo& ssl_info = request->ssl_info(); | 1501 const net::SSLInfo& ssl_info = request->ssl_info(); |
| 1502 if (ssl_info.cert != NULL) { | 1502 if (ssl_info.cert != NULL) { |
| 1503 int cert_id = CertStore::GetSharedInstance()->StoreCert(ssl_info.cert, | 1503 int cert_id = CertStore::GetInstance()->StoreCert(ssl_info.cert, |
| 1504 info->child_id()); | 1504 info->child_id()); |
| 1505 security_info = SSLManager::SerializeSecurityInfo( | 1505 security_info = SSLManager::SerializeSecurityInfo( |
| 1506 cert_id, ssl_info.cert_status, ssl_info.security_bits, | 1506 cert_id, ssl_info.cert_status, ssl_info.security_bits, |
| 1507 ssl_info.connection_status); | 1507 ssl_info.connection_status); |
| 1508 } | 1508 } |
| 1509 | 1509 |
| 1510 if (info->resource_handler()->OnResponseCompleted(info->request_id(), | 1510 if (info->resource_handler()->OnResponseCompleted(info->request_id(), |
| 1511 request->status(), | 1511 request->status(), |
| 1512 security_info)) { | 1512 security_info)) { |
| 1513 NotifyResponseCompleted(request, info->child_id()); | 1513 NotifyResponseCompleted(request, info->child_id()); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1588 | 1588 |
| 1589 PendingRequestList::const_iterator i = pending_requests_.find(request_id); | 1589 PendingRequestList::const_iterator i = pending_requests_.find(request_id); |
| 1590 if (i == pending_requests_.end()) | 1590 if (i == pending_requests_.end()) |
| 1591 return NULL; | 1591 return NULL; |
| 1592 | 1592 |
| 1593 return i->second; | 1593 return i->second; |
| 1594 } | 1594 } |
| 1595 | 1595 |
| 1596 static int GetCertID(net::URLRequest* request, int child_id) { | 1596 static int GetCertID(net::URLRequest* request, int child_id) { |
| 1597 if (request->ssl_info().cert) { | 1597 if (request->ssl_info().cert) { |
| 1598 return CertStore::GetSharedInstance()->StoreCert(request->ssl_info().cert, | 1598 return CertStore::GetInstance()->StoreCert(request->ssl_info().cert, |
| 1599 child_id); | 1599 child_id); |
|
Nico
2010/12/12 23:42:47
indent
Satish
2010/12/13 08:16:30
Done.
| |
| 1600 } | 1600 } |
| 1601 // If there is no SSL info attached to this request, we must either be a non | 1601 // If there is no SSL info attached to this request, we must either be a non |
| 1602 // secure request, or the request has been canceled or failed (before the SSL | 1602 // secure request, or the request has been canceled or failed (before the SSL |
| 1603 // info was populated), or the response is an error (we have seen 403, 404, | 1603 // info was populated), or the response is an error (we have seen 403, 404, |
| 1604 // and 501) made up by the proxy. | 1604 // and 501) made up by the proxy. |
| 1605 DCHECK(!request->url().SchemeIsSecure() || | 1605 DCHECK(!request->url().SchemeIsSecure() || |
| 1606 (request->status().status() == URLRequestStatus::CANCELED) || | 1606 (request->status().status() == URLRequestStatus::CANCELED) || |
| 1607 (request->status().status() == URLRequestStatus::FAILED) || | 1607 (request->status().status() == URLRequestStatus::FAILED) || |
| 1608 ((request->response_headers()->response_code() >= 400) && | 1608 ((request->response_headers()->response_code() >= 400) && |
| 1609 (request->response_headers()->response_code() <= 599))); | 1609 (request->response_headers()->response_code() <= 599))); |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1960 return is_prefetch_enabled_; | 1960 return is_prefetch_enabled_; |
| 1961 } | 1961 } |
| 1962 | 1962 |
| 1963 // static | 1963 // static |
| 1964 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { | 1964 void ResourceDispatcherHost::set_is_prefetch_enabled(bool value) { |
| 1965 is_prefetch_enabled_ = value; | 1965 is_prefetch_enabled_ = value; |
| 1966 } | 1966 } |
| 1967 | 1967 |
| 1968 // static | 1968 // static |
| 1969 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; | 1969 bool ResourceDispatcherHost::is_prefetch_enabled_ = false; |
| OLD | NEW |