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

Side by Side Diff: chromeos/tpm_token_loader.h

Issue 135193007: Use user specific NSSDatabase in CertLoader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_TPM_TOKEN_LOADER_H_ 5 #ifndef CHROMEOS_TPM_TOKEN_LOADER_H_
6 #define CHROMEOS_TPM_TOKEN_LOADER_H_ 6 #define CHROMEOS_TPM_TOKEN_LOADER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 17 matching lines...) Expand all
28 // should all be called from the UI thread. When the TPM token is loaded, 28 // should all be called from the UI thread. When the TPM token is loaded,
29 // or if the TPM should stay disabled for the session, the observers are 29 // or if the TPM should stay disabled for the session, the observers are
30 // notified using |OnTPMTokenReady|. 30 // notified using |OnTPMTokenReady|.
31 class CHROMEOS_EXPORT TPMTokenLoader : public LoginState::Observer { 31 class CHROMEOS_EXPORT TPMTokenLoader : public LoginState::Observer {
32 public: 32 public:
33 class Observer { 33 class Observer {
34 public: 34 public:
35 virtual ~Observer() {} 35 virtual ~Observer() {}
36 36
37 // Called when the TPM token initialization is done or the case where TPM 37 // Called when the TPM token initialization is done or the case where TPM
38 // should stay disabled is detected (e.g. on guest login). If TPM is 38 // should stay disabled is detected (e.g. on guest login).
39 // disabled, |tpm_user_pin|, |tpm_token_name| and |tpm_token_slot_id| will 39 virtual void OnTPMTokenReady() = 0;
40 // not be set.
41 virtual void OnTPMTokenReady(const std::string& tpm_user_pin,
42 const std::string& tpm_token_name,
43 int tpm_token_slot_id) = 0;
44 }; 40 };
45 41
46 // Sets the global instance. Must be called before any calls to Get(). 42 // Sets the global instance. Must be called before any calls to Get().
47 // The global instance will immediately start observing |LoginState|. 43 // The global instance will immediately start observing |LoginState|.
48 static void Initialize(); 44 static void Initialize();
49 45
50 // Destroys the global instance. 46 // Destroys the global instance.
51 static void Shutdown(); 47 static void Shutdown();
52 48
53 // Gets the global instance. Initialize() must be called before this. 49 // Gets the global instance. Initialize() must be called before this.
(...skipping 13 matching lines...) Expand all
67 // token loading. 63 // token loading.
68 void SetCryptoTaskRunner( 64 void SetCryptoTaskRunner(
69 const scoped_refptr<base::SequencedTaskRunner>& crypto_task_runner); 65 const scoped_refptr<base::SequencedTaskRunner>& crypto_task_runner);
70 66
71 void AddObserver(TPMTokenLoader::Observer* observer); 67 void AddObserver(TPMTokenLoader::Observer* observer);
72 void RemoveObserver(TPMTokenLoader::Observer* observer); 68 void RemoveObserver(TPMTokenLoader::Observer* observer);
73 69
74 // Checks if the TPM token in ready to be used. 70 // Checks if the TPM token in ready to be used.
75 bool IsTPMTokenReady() const; 71 bool IsTPMTokenReady() const;
76 72
73 std::string tpm_user_pin() const { return tpm_user_pin_; }
74
77 private: 75 private:
78 TPMTokenLoader(); 76 TPMTokenLoader();
79 virtual ~TPMTokenLoader(); 77 virtual ~TPMTokenLoader();
80 78
81 // Starts tpm token initialization if the user is logged in and the crypto 79 // Starts tpm token initialization if the user is logged in and the crypto
82 // task runner is set. 80 // task runner is set.
83 void MaybeStartTokenInitialization(); 81 void MaybeStartTokenInitialization();
84 82
85 // This is the cyclic chain of callbacks to initialize the TPM token. 83 // This is the cyclic chain of callbacks to initialize the TPM token.
86 void ContinueTokenInitialization(); 84 void ContinueTokenInitialization();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 scoped_refptr<base::SequencedTaskRunner> crypto_task_runner_; 136 scoped_refptr<base::SequencedTaskRunner> crypto_task_runner_;
139 137
140 base::WeakPtrFactory<TPMTokenLoader> weak_factory_; 138 base::WeakPtrFactory<TPMTokenLoader> weak_factory_;
141 139
142 DISALLOW_COPY_AND_ASSIGN(TPMTokenLoader); 140 DISALLOW_COPY_AND_ASSIGN(TPMTokenLoader);
143 }; 141 };
144 142
145 } // namespace chromeos 143 } // namespace chromeos
146 144
147 #endif // CHROMEOS_TPM_TOKEN_LOADER_H_ 145 #endif // CHROMEOS_TPM_TOKEN_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698