| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/cert_store.h" | 5 #include "chrome/browser/cert_store.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "chrome/browser/renderer_host/render_process_host.h" | 10 #include "chrome/browser/renderer_host/render_process_host.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // certificates for now. | 34 // certificates for now. |
| 35 // TODO(jcampan): we should be listening to events such as resource cached/ | 35 // TODO(jcampan): we should be listening to events such as resource cached/ |
| 36 // removed from cache, and remove the cert when we know it | 36 // removed from cache, and remove the cert when we know it |
| 37 // is not used anymore. | 37 // is not used anymore. |
| 38 | 38 |
| 39 // TODO(tc): This notification observer never gets removed because the | 39 // TODO(tc): This notification observer never gets removed because the |
| 40 // CertStore is never deleted. | 40 // CertStore is never deleted. |
| 41 NotificationService::current()->AddObserver(this, | 41 NotificationService::current()->AddObserver(this, |
| 42 NotificationType::RENDERER_PROCESS_TERMINATED, | 42 NotificationType::RENDERER_PROCESS_TERMINATED, |
| 43 NotificationService::AllSources()); | 43 NotificationService::AllSources()); |
| 44 NotificationService::current()->AddObserver(this, |
| 45 NotificationType::RENDERER_PROCESS_CRASHED, |
| 46 NotificationService::AllSources()); |
| 44 } | 47 } |
| 45 | 48 |
| 46 CertStore::~CertStore() { | 49 CertStore::~CertStore() { |
| 47 } | 50 } |
| 48 | 51 |
| 49 int CertStore::StoreCert(net::X509Certificate* cert, int process_id) { | 52 int CertStore::StoreCert(net::X509Certificate* cert, int process_id) { |
| 50 DCHECK(cert); | 53 DCHECK(cert); |
| 51 AutoLock autoLock(cert_lock_); | 54 AutoLock autoLock(cert_lock_); |
| 52 | 55 |
| 53 int cert_id; | 56 int cert_id; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 131 } |
| 129 | 132 |
| 130 // Erase the current item but keep the iterator valid. | 133 // Erase the current item but keep the iterator valid. |
| 131 process_id_to_cert_id_.erase(ids_iter++); | 134 process_id_to_cert_id_.erase(ids_iter++); |
| 132 } | 135 } |
| 133 } | 136 } |
| 134 | 137 |
| 135 void CertStore::Observe(NotificationType type, | 138 void CertStore::Observe(NotificationType type, |
| 136 const NotificationSource& source, | 139 const NotificationSource& source, |
| 137 const NotificationDetails& details) { | 140 const NotificationDetails& details) { |
| 138 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); | 141 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED || |
| 142 type == NotificationType::RENDERER_PROCESS_CRASHED); |
| 139 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); | 143 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); |
| 140 DCHECK(rph); | 144 DCHECK(rph); |
| 141 RemoveCertsForRenderProcesHost(rph->pid()); | 145 RemoveCertsForRenderProcesHost(rph->pid()); |
| 142 } | 146 } |
| OLD | NEW |