OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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_CRYPTO_MODULE_DELEGATE_NSS_H_ | |
6 #define CHROME_BROWSER_UI_CRYPTO_MODULE_DELEGATE_NSS_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/compiler_specific.h" | |
11 #include "base/synchronization/waitable_event.h" | |
12 #include "chrome/browser/ui/crypto_module_password_dialog.h" | |
13 #include "crypto/nss_crypto_module_delegate.h" | |
14 | |
15 namespace content { | |
16 class ResourceContext; | |
17 } | |
18 | |
19 class ChromeNSSCryptoModuleDelegate | |
Ryan Sleevi
2013/12/05 00:23:19
Why is the free function in namespace chrome, but
mattm
2013/12/05 04:41:25
hm, I guess I didn't like chrome::NSSCryptoModuleD
| |
20 : public crypto::NSSCryptoModuleDelegate { | |
21 public: | |
22 // Create a ChromeNSSCryptoModuleDelegate. |reason| is used to select what | |
23 // string to show the user, |server| is displayed to indicate which connection | |
24 // is causing the dialog to appear. | |
25 ChromeNSSCryptoModuleDelegate(chrome::CryptoModulePasswordReason reason, | |
26 const std::string& server); | |
Ryan Sleevi
2013/12/05 00:23:19
I feel like we definitely should be using the GURL
mattm
2013/12/05 04:41:25
This can also be used with client auth, where the
| |
27 | |
28 virtual ~ChromeNSSCryptoModuleDelegate(); | |
29 | |
30 // Must be called on IO thread. Returns true if the delegate is ready for use. | |
31 // If |initialization_complete_callback| is non-null, the initialization will | |
32 // proceed asynchronously and the callback will be run once the delegate is | |
33 // ready to use. | |
34 bool InitializeSlot(content::ResourceContext* context, | |
35 const base::Closure& initialization_complete_callback) | |
36 WARN_UNUSED_RESULT; | |
Ryan Sleevi
2013/12/05 00:23:19
Unnecessary W_U_R
mattm
2013/12/05 04:41:25
I think this one is necessary. If you pass a callb
| |
37 | |
38 // crypto::NSSCryptoModuleDelegate implementation. | |
39 virtual crypto::ScopedPK11Slot RequestSlot() OVERRIDE; | |
40 | |
41 // crypto::CryptoModuleBlockingPasswordDelegate implementation. | |
42 virtual std::string RequestPassword(const std::string& slot_name, | |
43 bool retry, | |
44 bool* cancelled) OVERRIDE; | |
45 | |
46 private: | |
47 void ShowDialog(const std::string& slot_name, bool retry); | |
48 | |
49 void GotPassword(const char* password); | |
50 | |
51 void DidGetSlot(const base::Closure& callback, crypto::ScopedPK11Slot slot); | |
52 | |
53 base::WaitableEvent event_; | |
54 chrome::CryptoModulePasswordReason reason_; | |
55 std::string server_; | |
56 std::string password_; | |
57 crypto::ScopedPK11Slot slot_; | |
58 bool cancelled_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(ChromeNSSCryptoModuleDelegate); | |
61 }; | |
62 | |
63 namespace chrome { | |
64 | |
65 crypto::CryptoModuleBlockingPasswordDelegate* | |
66 CreateCryptoModuleBlockingPasswordDelegate( | |
67 CryptoModulePasswordReason reason, | |
68 const std::string& server); | |
69 | |
70 } // namespace chrome | |
71 | |
72 #endif // CHROME_BROWSER_UI_CRYPTO_MODULE_DELEGATE_NSS_H_ | |
OLD | NEW |