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 CryptoModule; |
| 19 class X509Certificate; |
| 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 // |module|. |reason| describes the purpose of the authentication and |
| 37 // affects the message displayed in the dialog. |server| is the name |
| 38 // of the server which requested the access. |
| 39 void ShowPK11PasswordDialog(const std::string& module_name, |
| 40 bool retry, |
| 41 PK11PasswordReason reason, |
| 42 const std::string& server, |
| 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& server); |
| 50 |
| 51 // Asynchronously unlock |module|, if necessary. |callback| is called when done |
| 52 // (regardless if module was successfully unlocked or not). Should only be |
| 53 // called on UI thread. |
| 54 void UnlockSlotIfNecessary(net::CryptoModule* module, |
| 55 browser::PK11PasswordReason reason, |
| 56 const std::string& server, |
| 57 Callback0::Type* callback); |
| 58 |
| 59 // Asynchronously unlock the |cert|'s module, if necessary. |callback| is |
| 60 // called when done (regardless if module was successfully unlocked or not). |
| 61 // Should only be called on UI thread. |
| 62 void UnlockCertSlotIfNecessary(net::X509Certificate* cert, |
| 63 browser::PK11PasswordReason reason, |
| 64 const std::string& server, |
| 65 Callback0::Type* callback); |
| 66 |
| 67 } // namespace browser |
| 68 |
| 69 #endif // CHROME_BROWSER_UI_PK11_PASSWORD_DIALOG_H_ |
OLD | NEW |