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