Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Side by Side Diff: content/public/browser/cert_store.h

Issue 9691003: Add Content API around CertStore. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix clang Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/content_browser.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_PUBLIC_BROWSER_CERT_STORE_H_
6 #define CONTENT_PUBLIC_BROWSER_CERT_STORE_H_
7 #pragma once
8
9 #include "base/memory/ref_counted.h"
10 #include "content/common/content_export.h"
11
12 namespace net {
13 class X509Certificate;
14 }
15
16 namespace content {
17
18 // The purpose of the cert store is to provide an easy way to store/retrieve
19 // X509Certificate objects. When stored, an X509Certificate object is
20 // associated with a RenderProcessHost. If all the RenderProcessHosts
21 // associated with the cert have exited, the cert is removed from the store.
22 // This class is used by the SSLManager to keep track of the certs associated
23 // to loaded resources.
24 // It can be accessed from the UI and IO threads (it is thread-safe).
25 // Note that the cert ids will overflow if we register more than 2^32 - 1 certs
26 // in 1 browsing session (which is highly unlikely to happen).
27 class CertStore {
28 public:
29 // Returns the singleton instance of the CertStore.
30 CONTENT_EXPORT static CertStore* GetInstance();
31
32 // Stores the specified cert and returns the id associated with it. The cert
33 // is associated to the specified RenderProcessHost.
34 // When all the RenderProcessHosts associated with a cert have exited, the
35 // cert is removed from the store.
36 // Note: ids starts at 1.
37 virtual int StoreCert(net::X509Certificate* cert,
38 int render_process_host_id) = 0;
39
40 // Tries to retrieve the previously stored cert associated with the specified
41 // |cert_id|. Returns whether the cert could be found, and, if |cert| is
42 // non-NULL, copies it in.
43 virtual bool RetrieveCert(int cert_id,
44 scoped_refptr<net::X509Certificate>* cert) = 0;
45
46 protected:
47 virtual ~CertStore() {}
48 };
49
50 } // namespace content
51
52 #endif // CONTENT_PUBLIC_BROWSER_CERT_STORE_H_
OLDNEW
« no previous file with comments | « content/content_browser.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698