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

Side by Side Diff: content/browser/cert_store_impl.h

Issue 11274038: content/browser: Move more files into the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win - part2 Created 8 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 CONTENT_BROWSER_CERT_STORE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_CERT_STORE_IMPL_H_
6 #define CONTENT_BROWSER_CERT_STORE_IMPL_H_ 6 #define CONTENT_BROWSER_CERT_STORE_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
11 #include "base/synchronization/lock.h" 11 #include "base/synchronization/lock.h"
12 #include "content/public/browser/cert_store.h" 12 #include "content/public/browser/cert_store.h"
13 #include "content/public/browser/notification_observer.h" 13 #include "content/public/browser/notification_observer.h"
14 #include "content/public/browser/notification_registrar.h" 14 #include "content/public/browser/notification_registrar.h"
15 #include "net/base/x509_certificate.h" 15 #include "net/base/x509_certificate.h"
16 16
17 class CertStoreImpl : public content::CertStore, 17 namespace content {
18 public content::NotificationObserver { 18
19 class CertStoreImpl : public CertStore,
20 public NotificationObserver {
19 public: 21 public:
20 // Returns the singleton instance of the CertStore. 22 // Returns the singleton instance of the CertStore.
21 static CertStoreImpl* GetInstance(); 23 static CertStoreImpl* GetInstance();
22 24
23 // CertStore implementation: 25 // CertStore implementation:
24 virtual int StoreCert(net::X509Certificate* cert, 26 virtual int StoreCert(net::X509Certificate* cert,
25 int render_process_host_id) OVERRIDE; 27 int render_process_host_id) OVERRIDE;
26 virtual bool RetrieveCert(int cert_id, 28 virtual bool RetrieveCert(int cert_id,
27 scoped_refptr<net::X509Certificate>* cert) OVERRIDE; 29 scoped_refptr<net::X509Certificate>* cert) OVERRIDE;
28 30
29 // content::NotificationObserver implementation. 31 // NotificationObserver implementation.
30 virtual void Observe(int type, 32 virtual void Observe(int type,
31 const content::NotificationSource& source, 33 const NotificationSource& source,
32 const content::NotificationDetails& details) OVERRIDE; 34 const NotificationDetails& details) OVERRIDE;
33 protected: 35 protected:
34 CertStoreImpl(); 36 CertStoreImpl();
35 virtual ~CertStoreImpl(); 37 virtual ~CertStoreImpl();
36 38
37 private: 39 private:
38 friend struct DefaultSingletonTraits<CertStoreImpl>; 40 friend struct DefaultSingletonTraits<CertStoreImpl>;
39 41
40 void RegisterForNotification(); 42 void RegisterForNotification();
41 43
42 // Remove the specified cert from id_to_cert_ and cert_to_id_. 44 // Remove the specified cert from id_to_cert_ and cert_to_id_.
43 // NOTE: the caller (RemoveCertsForRenderProcesHost) must hold cert_lock_. 45 // NOTE: the caller (RemoveCertsForRenderProcesHost) must hold cert_lock_.
44 void RemoveCertInternal(int cert_id); 46 void RemoveCertInternal(int cert_id);
45 47
46 // Removes all the certs associated with the specified process from the store. 48 // Removes all the certs associated with the specified process from the store.
47 void RemoveCertsForRenderProcesHost(int render_process_host_id); 49 void RemoveCertsForRenderProcesHost(int render_process_host_id);
48 50
49 typedef std::multimap<int, int> IDMap; 51 typedef std::multimap<int, int> IDMap;
50 typedef std::map<int, scoped_refptr<net::X509Certificate> > CertMap; 52 typedef std::map<int, scoped_refptr<net::X509Certificate> > CertMap;
51 typedef std::map<net::X509Certificate*, int, net::X509Certificate::LessThan> 53 typedef std::map<net::X509Certificate*, int, net::X509Certificate::LessThan>
52 ReverseCertMap; 54 ReverseCertMap;
53 55
54 // Is only used on the UI Thread. 56 // Is only used on the UI Thread.
55 content::NotificationRegistrar registrar_; 57 NotificationRegistrar registrar_;
56 58
57 IDMap process_id_to_cert_id_; 59 IDMap process_id_to_cert_id_;
58 IDMap cert_id_to_process_id_; 60 IDMap cert_id_to_process_id_;
59 61
60 CertMap id_to_cert_; 62 CertMap id_to_cert_;
61 ReverseCertMap cert_to_id_; 63 ReverseCertMap cert_to_id_;
62 64
63 int next_cert_id_; 65 int next_cert_id_;
64 66
65 // This lock protects: process_to_ids_, id_to_processes_, id_to_cert_ and 67 // This lock protects: process_to_ids_, id_to_processes_, id_to_cert_ and
66 // cert_to_id_. 68 // cert_to_id_.
67 base::Lock cert_lock_; 69 base::Lock cert_lock_;
68 70
69 DISALLOW_COPY_AND_ASSIGN(CertStoreImpl); 71 DISALLOW_COPY_AND_ASSIGN(CertStoreImpl);
70 }; 72 };
71 73
74 } // namespace content
75
72 #endif // CONTENT_BROWSER_CERT_STORE_IMPL_H_ 76 #endif // CONTENT_BROWSER_CERT_STORE_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/browser_url_handler_impl_unittest.cc ('k') | content/browser/cert_store_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698