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

Side by Side Diff: chrome/browser/ui/crypto_module_password_dialog.h

Issue 6580058: NSS: Unlock crypto devices when populating cert manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: missing newline Created 9 years, 9 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 (c) 2011 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_CRYPTO_MODULE_PASSWORD_DIALOG_H_ 5 #ifndef CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_H_
6 #define CHROME_BROWSER_UI_CRYPTO_MODULE_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 #include <vector>
10 11
11 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/ref_counted.h"
12 14
13 namespace base { 15 namespace base {
14 class CryptoModuleBlockingPasswordDelegate; 16 class CryptoModuleBlockingPasswordDelegate;
15 } 17 }
16 18
17 namespace net { 19 namespace net {
18 class CryptoModule; 20 class CryptoModule;
21 typedef std::vector<scoped_refptr<CryptoModule> > CryptoModuleList;
wtc 2011/03/02 03:33:28 I hope we can avoid repeating this typedef in mult
mattm 2011/03/05 02:16:32 Yeah, it's a bit ugly. Just a question of how far
19 class X509Certificate; 22 class X509Certificate;
20 } 23 }
21 24
22 namespace browser { 25 namespace browser {
23 26
24 // An enum to describe the reason for the password request. 27 // An enum to describe the reason for the password request.
25 enum CryptoModulePasswordReason { 28 enum CryptoModulePasswordReason {
26 kCryptoModulePasswordKeygen, 29 kCryptoModulePasswordKeygen,
27 kCryptoModulePasswordCertEnrollment, 30 kCryptoModulePasswordCertEnrollment,
28 kCryptoModulePasswordClientAuth, 31 kCryptoModulePasswordClientAuth,
32 kCryptoModulePasswordCertManager,
wtc 2011/03/02 03:33:28 Perhaps this and the associated string ID in the .
mattm 2011/03/05 02:16:32 Done.
29 kCryptoModulePasswordCertImport, 33 kCryptoModulePasswordCertImport,
30 kCryptoModulePasswordCertExport, 34 kCryptoModulePasswordCertExport,
31 }; 35 };
32 36
33 typedef Callback1<const char*>::Type CryptoModulePasswordCallback; 37 typedef Callback1<const char*>::Type CryptoModulePasswordCallback;
34 38
35 // Display a dialog, prompting the user to authenticate to unlock 39 // Display a dialog, prompting the user to authenticate to unlock
36 // |module|. |reason| describes the purpose of the authentication and 40 // |module|. |reason| describes the purpose of the authentication and
37 // affects the message displayed in the dialog. |server| is the name 41 // affects the message displayed in the dialog. |server| is the name
38 // of the server which requested the access. 42 // of the server which requested the access.
39 void ShowCryptoModulePasswordDialog(const std::string& module_name, 43 void ShowCryptoModulePasswordDialog(const std::string& module_name,
40 bool retry, 44 bool retry,
41 CryptoModulePasswordReason reason, 45 CryptoModulePasswordReason reason,
42 const std::string& server, 46 const std::string& server,
43 CryptoModulePasswordCallback* callback); 47 CryptoModulePasswordCallback* callback);
44 48
45 // Returns a CryptoModuleBlockingPasswordDelegate to open a dialog and block 49 // Returns a CryptoModuleBlockingPasswordDelegate to open a dialog and block
46 // until returning. Should only be used on a worker thread. 50 // until returning. Should only be used on a worker thread.
47 base::CryptoModuleBlockingPasswordDelegate* 51 base::CryptoModuleBlockingPasswordDelegate*
48 NewCryptoModuleBlockingDialogDelegate( 52 NewCryptoModuleBlockingDialogDelegate(
49 CryptoModulePasswordReason reason, 53 CryptoModulePasswordReason reason,
50 const std::string& server); 54 const std::string& server);
51 55
52 // Asynchronously unlock |module|, if necessary. |callback| is called when done 56 // Asynchronously unlock |module|, if necessary. |callback| is called when done
53 // (regardless if module was successfully unlocked or not). Should only be 57 // (regardless if module was successfully unlocked or not). Should only be
54 // called on UI thread. 58 // called on UI thread.
wtc 2011/03/02 03:33:28 Please update the comment.
mattm 2011/03/05 02:16:32 Done.
55 void UnlockSlotIfNecessary(net::CryptoModule* module, 59 void UnlockSlotsIfNecessary(const net::CryptoModuleList& modules,
56 browser::CryptoModulePasswordReason reason, 60 browser::CryptoModulePasswordReason reason,
57 const std::string& server, 61 const std::string& server,
58 Callback0::Type* callback); 62 Callback0::Type* callback);
59 63
60 // Asynchronously unlock the |cert|'s module, if necessary. |callback| is 64 // Asynchronously unlock the |cert|'s module, if necessary. |callback| is
61 // called when done (regardless if module was successfully unlocked or not). 65 // called when done (regardless if module was successfully unlocked or not).
62 // Should only be called on UI thread. 66 // Should only be called on UI thread.
63 void UnlockCertSlotIfNecessary(net::X509Certificate* cert, 67 void UnlockCertSlotIfNecessary(net::X509Certificate* cert,
64 browser::CryptoModulePasswordReason reason, 68 browser::CryptoModulePasswordReason reason,
65 const std::string& server, 69 const std::string& server,
66 Callback0::Type* callback); 70 Callback0::Type* callback);
67 71
68 } // namespace browser 72 } // namespace browser
69 73
70 #endif // CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_H_ 74 #endif // CHROME_BROWSER_UI_CRYPTO_MODULE_PASSWORD_DIALOG_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698