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

Side by Side Diff: chromeos/cert_loader.h

Issue 22588002: Refactor the client certificate code in chromeos/network/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments. Created 7 years, 4 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 | « chrome/browser/chromeos/options/network_connect.cc ('k') | chromeos/cert_loader.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 CHROMEOS_CERT_LOADER_H_ 5 #ifndef CHROMEOS_CERT_LOADER_H_
6 #define CHROMEOS_CERT_LOADER_H_ 6 #define CHROMEOS_CERT_LOADER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h"
10 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
13 #include "base/observer_list_threadsafe.h" 14 #include "base/observer_list_threadsafe.h"
14 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
15 #include "chromeos/chromeos_export.h" 16 #include "chromeos/chromeos_export.h"
16 #include "chromeos/dbus/dbus_method_call_status.h" 17 #include "chromeos/dbus/dbus_method_call_status.h"
17 #include "chromeos/login/login_state.h" 18 #include "chromeos/login/login_state.h"
18 #include "net/cert/cert_database.h" 19 #include "net/cert/cert_database.h"
19 #include "net/cert/x509_certificate.h" 20 #include "net/cert/x509_certificate.h"
20 21
21 namespace base { 22 namespace base {
22 class SequencedTaskRunner; 23 class SequencedTaskRunner;
24 class TaskRunner;
23 } 25 }
24 26
25 namespace crypto { 27 namespace crypto {
26 class SymmetricKey; 28 class SymmetricKey;
27 } 29 }
28 30
29 namespace chromeos { 31 namespace chromeos {
30 32
31 // This class is responsible for initializing the TPM token and loading 33 // This class is responsible for initializing the TPM token and loading
32 // certificates once the TPM is initialized. It is expected to be constructed 34 // certificates once the TPM is initialized. It is expected to be constructed
(...skipping 25 matching lines...) Expand all
58 60
59 // Destroys the global instance. 61 // Destroys the global instance.
60 static void Shutdown(); 62 static void Shutdown();
61 63
62 // Gets the global instance. Initialize() must be called first. 64 // Gets the global instance. Initialize() must be called first.
63 static CertLoader* Get(); 65 static CertLoader* Get();
64 66
65 // Returns true if the global instance has been initialized. 67 // Returns true if the global instance has been initialized.
66 static bool IsInitialized(); 68 static bool IsInitialized();
67 69
70 static std::string GetPkcs11IdForCert(const net::X509Certificate& cert);
71
68 // |crypto_task_runner| is the task runner that any synchronous crypto calls 72 // |crypto_task_runner| is the task runner that any synchronous crypto calls
69 // should be made from, e.g. in Chrome this is the IO thread. Must be called 73 // should be made from, e.g. in Chrome this is the IO thread. Must be called
70 // after the thread is started. Certificate loading will not happen unless 74 // after the thread is started. Certificate loading will not happen unless
71 // this is set. 75 // this is set.
72 void SetCryptoTaskRunner( 76 void SetCryptoTaskRunner(
73 const scoped_refptr<base::SequencedTaskRunner>& crypto_task_runner); 77 const scoped_refptr<base::SequencedTaskRunner>& crypto_task_runner);
74 78
75 // Sets the task runner that any slow calls will be made from, e.g. calls 79 // Sets the task runner that any slow calls will be made from, e.g. calls
76 // to the NSS database. If not set, uses base::WorkerPool. 80 // to the NSS database. If not set, uses base::WorkerPool.
77 void SetSlowTaskRunnerForTest( 81 void SetSlowTaskRunnerForTest(
78 const scoped_refptr<base::SequencedTaskRunner>& task_runner); 82 const scoped_refptr<base::TaskRunner>& task_runner);
79 83
80 void AddObserver(CertLoader::Observer* observer); 84 void AddObserver(CertLoader::Observer* observer);
81 void RemoveObserver(CertLoader::Observer* observer); 85 void RemoveObserver(CertLoader::Observer* observer);
82 86
83 // Returns true when the certificate list has been requested but not loaded. 87 // Returns true when the certificate list has been requested but not loaded.
84 bool CertificatesLoading() const; 88 bool CertificatesLoading() const;
85 89
86 // Returns true if the TPM is available for hardware-backed certificates. 90 // Returns true if the TPM is available for hardware-backed certificates.
87 bool IsHardwareBacked() const; 91 bool IsHardwareBacked() const;
88 92
89 std::string GetPkcs11IdForCert(const net::X509Certificate& cert) const;
90
91 bool certificates_loaded() const { return certificates_loaded_; } 93 bool certificates_loaded() const { return certificates_loaded_; }
92 94
93 // TPM info is only valid once the TPM is available (IsHardwareBacked is 95 // TPM info is only valid once the TPM is available (IsHardwareBacked is
94 // true). Otherwise empty strings will be returned. 96 // true). Otherwise empty strings will be returned.
95 const std::string& tpm_token_name() const { return tpm_token_name_; } 97 const std::string& tpm_token_name() const { return tpm_token_name_; }
96 const std::string& tpm_token_slot() const { return tpm_token_slot_; } 98 const std::string& tpm_token_slot() const { return tpm_token_slot_; }
97 const std::string& tpm_user_pin() const { return tpm_user_pin_; } 99 const std::string& tpm_user_pin() const { return tpm_user_pin_; }
98 100
99 // This will be empty until certificates_loaded() is true. 101 // This will be empty until certificates_loaded() is true.
100 const net::CertificateList& cert_list() const { return cert_list_; } 102 const net::CertificateList& cert_list() const { return cert_list_; }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // This factory should be used only for callbacks during updating the 184 // This factory should be used only for callbacks during updating the
183 // certificate list. 185 // certificate list.
184 base::WeakPtrFactory<CertLoader> update_certificates_factory_; 186 base::WeakPtrFactory<CertLoader> update_certificates_factory_;
185 187
186 DISALLOW_COPY_AND_ASSIGN(CertLoader); 188 DISALLOW_COPY_AND_ASSIGN(CertLoader);
187 }; 189 };
188 190
189 } // namespace chromeos 191 } // namespace chromeos
190 192
191 #endif // CHROMEOS_CERT_LOADER_H_ 193 #endif // CHROMEOS_CERT_LOADER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/options/network_connect.cc ('k') | chromeos/cert_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698