OLD | NEW |
1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_CERT_STORE_H_ | 5 #ifndef CHROME_BROWSER_CERT_STORE_H_ |
6 #define CHROME_BROWSER_CERT_STORE_H_ | 6 #define CHROME_BROWSER_CERT_STORE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/lock.h" | 10 #include "base/lock.h" |
11 #include "base/singleton.h" | 11 #include "base/singleton.h" |
(...skipping 15 matching lines...) Expand all Loading... |
27 // Returns the singleton instance of the CertStore. | 27 // Returns the singleton instance of the CertStore. |
28 static CertStore* GetSharedInstance(); | 28 static CertStore* GetSharedInstance(); |
29 | 29 |
30 // Stores the specified cert and returns the id associated with it. The cert | 30 // Stores the specified cert and returns the id associated with it. The cert |
31 // is associated to the specified RenderProcessHost. | 31 // is associated to the specified RenderProcessHost. |
32 // When all the RenderProcessHosts associated with a cert have exited, the | 32 // When all the RenderProcessHosts associated with a cert have exited, the |
33 // cert is removed from the store. | 33 // cert is removed from the store. |
34 // Note: ids starts at 1. | 34 // Note: ids starts at 1. |
35 int StoreCert(net::X509Certificate* cert, int render_process_host_id); | 35 int StoreCert(net::X509Certificate* cert, int render_process_host_id); |
36 | 36 |
37 // Retrieves the previously stored cert associated with the specified | 37 // Tries to retrieve the previously stored cert associated with the specified |
38 // |cert_id| and set it in |cert|. Returns false if no cert was found for | 38 // |cert_id|. Returns whether the cert could be found, and, if |cert| is |
39 // that id. | 39 // non-NULL, copies it in. |
40 bool RetrieveCert(int cert_id, scoped_refptr<net::X509Certificate>* cert); | 40 bool RetrieveCert(int cert_id, scoped_refptr<net::X509Certificate>* cert); |
41 | 41 |
42 // NotificationObserver implementation. | 42 // NotificationObserver implementation. |
43 virtual void Observe(NotificationType type, | 43 virtual void Observe(NotificationType type, |
44 const NotificationSource& source, | 44 const NotificationSource& source, |
45 const NotificationDetails& details); | 45 const NotificationDetails& details); |
46 | 46 |
47 private: | 47 private: |
48 friend struct DefaultSingletonTraits<CertStore>; | 48 friend struct DefaultSingletonTraits<CertStore>; |
49 | 49 |
(...skipping 23 matching lines...) Expand all Loading... |
73 int next_cert_id_; | 73 int next_cert_id_; |
74 | 74 |
75 // This lock protects: process_to_ids_, id_to_processes_, id_to_cert_ and | 75 // This lock protects: process_to_ids_, id_to_processes_, id_to_cert_ and |
76 // cert_to_id_. | 76 // cert_to_id_. |
77 Lock cert_lock_; | 77 Lock cert_lock_; |
78 | 78 |
79 DISALLOW_COPY_AND_ASSIGN(CertStore); | 79 DISALLOW_COPY_AND_ASSIGN(CertStore); |
80 }; | 80 }; |
81 | 81 |
82 #endif // CHROME_BROWSER_CERT_STORE_H_ | 82 #endif // CHROME_BROWSER_CERT_STORE_H_ |
OLD | NEW |