OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_UI_PK11_PASSWORD_DIALOG_H_ | 5 #ifndef CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_H_ |
6 #define CHROME_BROWSER_UI_PK11_PASSWORD_DIALOG_H_ | 6 #define CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class PK11BlockingPasswordDelegate; | 14 class CryptoModuleBlockingPasswordDelegate; |
15 } | 15 } |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 class CryptoModule; | 18 class CryptoModule; |
19 class X509Certificate; | 19 class X509Certificate; |
20 } | 20 } |
21 | 21 |
22 namespace browser { | 22 namespace browser { |
23 | 23 |
24 // An enum to describe the reason for the password request. | 24 // An enum to describe the reason for the password request. |
25 enum PK11PasswordReason { | 25 enum CryptoModulePasswordReason { |
26 kPK11PasswordKeygen, | 26 kCryptoModulePasswordKeygen, |
27 kPK11PasswordCertEnrollment, | 27 kCryptoModulePasswordCertEnrollment, |
28 kPK11PasswordClientAuth, | 28 kCryptoModulePasswordClientAuth, |
29 kPK11PasswordCertImport, | 29 kCryptoModulePasswordCertImport, |
30 kPK11PasswordCertExport, | 30 kCryptoModulePasswordCertExport, |
31 }; | 31 }; |
32 | 32 |
33 typedef Callback1<const char*>::Type PK11PasswordCallback; | 33 typedef Callback1<const char*>::Type CryptoModulePasswordCallback; |
34 | 34 |
35 // Display a dialog, prompting the user to authenticate to unlock | 35 // Display a dialog, prompting the user to authenticate to unlock |
36 // |module|. |reason| describes the purpose of the authentication and | 36 // |module|. |reason| describes the purpose of the authentication and |
37 // affects the message displayed in the dialog. |server| is the name | 37 // affects the message displayed in the dialog. |server| is the name |
38 // of the server which requested the access. | 38 // of the server which requested the access. |
39 void ShowPK11PasswordDialog(const std::string& module_name, | 39 void ShowCryptoModulePasswordDialog(const std::string& module_name, |
40 bool retry, | 40 bool retry, |
41 PK11PasswordReason reason, | 41 CryptoModulePasswordReason reason, |
42 const std::string& server, | 42 const std::string& server, |
43 PK11PasswordCallback* callback); | 43 CryptoModulePasswordCallback* callback); |
44 | 44 |
45 // Returns a PK11BlockingPasswordDelegate to open a dialog and block | 45 // Returns a CryptoModuleBlockingPasswordDelegate to open a dialog and block |
46 // until returning. Should only be used on a worker thread. | 46 // until returning. Should only be used on a worker thread. |
47 base::PK11BlockingPasswordDelegate* NewPK11BlockingDialogDelegate( | 47 base::CryptoModuleBlockingPasswordDelegate* |
48 PK11PasswordReason reason, | 48 NewCryptoModuleBlockingDialogDelegate( |
49 const std::string& server); | 49 CryptoModulePasswordReason reason, |
| 50 const std::string& server); |
50 | 51 |
51 // Asynchronously unlock |module|, if necessary. |callback| is called when done | 52 // Asynchronously unlock |module|, if necessary. |callback| is called when done |
52 // (regardless if module was successfully unlocked or not). Should only be | 53 // (regardless if module was successfully unlocked or not). Should only be |
53 // called on UI thread. | 54 // called on UI thread. |
54 void UnlockSlotIfNecessary(net::CryptoModule* module, | 55 void UnlockSlotIfNecessary(net::CryptoModule* module, |
55 browser::PK11PasswordReason reason, | 56 browser::CryptoModulePasswordReason reason, |
56 const std::string& server, | 57 const std::string& server, |
57 Callback0::Type* callback); | 58 Callback0::Type* callback); |
58 | 59 |
59 // Asynchronously unlock the |cert|'s module, if necessary. |callback| is | 60 // Asynchronously unlock the |cert|'s module, if necessary. |callback| is |
60 // called when done (regardless if module was successfully unlocked or not). | 61 // called when done (regardless if module was successfully unlocked or not). |
61 // Should only be called on UI thread. | 62 // Should only be called on UI thread. |
62 void UnlockCertSlotIfNecessary(net::X509Certificate* cert, | 63 void UnlockCertSlotIfNecessary(net::X509Certificate* cert, |
63 browser::PK11PasswordReason reason, | 64 browser::CryptoModulePasswordReason reason, |
64 const std::string& server, | 65 const std::string& server, |
65 Callback0::Type* callback); | 66 Callback0::Type* callback); |
66 | 67 |
67 } // namespace browser | 68 } // namespace browser |
68 | 69 |
69 #endif // CHROME_BROWSER_UI_PK11_PASSWORD_DIALOG_H_ | 70 #endif // CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_H_ |
OLD | NEW |