| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_SIGNED_CERTIFICATE_TIMESTAMP_STORE_H_ | |
| 6 #define CONTENT_PUBLIC_BROWSER_SIGNED_CERTIFICATE_TIMESTAMP_STORE_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "content/common/content_export.h" | |
| 10 | |
| 11 namespace net { | |
| 12 namespace ct { | |
| 13 struct SignedCertificateTimestamp; | |
| 14 } // namespace ct | |
| 15 } // namespace net | |
| 16 | |
| 17 namespace content { | |
| 18 | |
| 19 // The purpose of the SignedCertificateTimestampStore is to provide an easy way | |
| 20 // to store/retrieve SignedCertificateTimestamp objects. When stored, | |
| 21 // SignedCertificateTimestamp objects are associated with a RenderProcessHost. | |
| 22 // If all the RenderProcessHosts associated with the SCT have exited, the SCT | |
| 23 // is removed from the store. This class is used by the SSLManager to keep | |
| 24 // track of the SCTs associated with loaded resources. It can be accessed from | |
| 25 // the UI and IO threads (it is thread-safe). Note that the SCT ids will | |
| 26 // overflow if we register more than 2^32 - 1 SCTs in 1 browsing session (which | |
| 27 // is highly unlikely to happen). | |
| 28 class SignedCertificateTimestampStore { | |
| 29 public: | |
| 30 // Returns the singleton instance of the SignedCertificateTimestampStore. | |
| 31 CONTENT_EXPORT static SignedCertificateTimestampStore* GetInstance(); | |
| 32 | |
| 33 // Stores the specified SCT and returns the id associated with it. The SCT | |
| 34 // is associated with the specified RenderProcessHost. | |
| 35 // When all the RenderProcessHosts associated with a SCT have exited, the | |
| 36 // SCT is removed from the store. | |
| 37 // Note: ids start at 1. | |
| 38 virtual int Store(net::ct::SignedCertificateTimestamp* sct, | |
| 39 int render_process_host_id) = 0; | |
| 40 | |
| 41 // Tries to retrieve the previously stored SCT associated with the specified | |
| 42 // |sct_id|. Returns whether the SCT could be found, and, if |sct| is | |
| 43 // non-nullptr, copies it in. | |
| 44 virtual bool Retrieve( | |
| 45 int sct_id, scoped_refptr<net::ct::SignedCertificateTimestamp>* sct) = 0; | |
| 46 | |
| 47 protected: | |
| 48 virtual ~SignedCertificateTimestampStore() {} | |
| 49 }; | |
| 50 | |
| 51 } // namespace content | |
| 52 | |
| 53 #endif // CONTENT_PUBLIC_BROWSER_SIGNED_CERTIFICATE_TIMESTAMP_STORE_H_ | |
| OLD | NEW |