OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_DELEGATE_NSS_H_ | 5 #ifndef CHROME_BROWSER_UI_CRYPTO_MODULE_DELEGATE_NSS_H_ |
6 #define CHROME_BROWSER_UI_CRYPTO_MODULE_DELEGATE_NSS_H_ | 6 #define CHROME_BROWSER_UI_CRYPTO_MODULE_DELEGATE_NSS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback_forward.h" | |
10 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/macros.h" | |
11 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
12 #include "chrome/browser/ui/crypto_module_password_dialog.h" | 14 #include "chrome/browser/ui/crypto_module_password_dialog.h" |
13 #include "crypto/nss_crypto_module_delegate.h" | 15 #include "crypto/nss_crypto_module_delegate.h" |
14 #include "net/base/host_port_pair.h" | 16 #include "net/base/host_port_pair.h" |
15 | 17 |
16 namespace content { | 18 namespace cert_database { |
17 class ResourceContext; | 19 class CertDatabaseServiceIOPart; |
18 } | 20 } |
19 | 21 |
20 // Delegate to handle unlocking a slot or indicating which slot to store a key | 22 // Delegate to handle unlocking a slot or indicating which slot to store a key |
21 // in. When passing to NSS functions which take a wincx argument, use the value | 23 // in. When passing to NSS functions which take a wincx argument, use the value |
22 // returned from the wincx() method. | 24 // returned from the wincx() method. |
23 class ChromeNSSCryptoModuleDelegate | 25 class ChromeNSSCryptoModuleDelegate : public crypto::NSSCryptoModuleDelegate { |
24 : public crypto::NSSCryptoModuleDelegate { | |
25 public: | 26 public: |
26 // Create a ChromeNSSCryptoModuleDelegate. |reason| is used to select what | 27 // Create a ChromeNSSCryptoModuleDelegate. |reason| is used to select what |
27 // string to show the user, |server| is displayed to indicate which connection | 28 // string to show the user, |server| is displayed to indicate which connection |
28 // is causing the dialog to appear. |slot| can be NULL. | 29 // is causing the dialog to appear. |slot| can be NULL. |
29 ChromeNSSCryptoModuleDelegate(chrome::CryptoModulePasswordReason reason, | 30 ChromeNSSCryptoModuleDelegate(chrome::CryptoModulePasswordReason reason, |
30 const net::HostPortPair& server, | 31 const net::HostPortPair& server, |
31 crypto::ScopedPK11Slot slot); | 32 crypto::ScopedPK11Slot slot); |
32 | 33 |
33 virtual ~ChromeNSSCryptoModuleDelegate(); | 34 virtual ~ChromeNSSCryptoModuleDelegate(); |
34 | 35 |
35 // Must be called on IO thread. Creates a delegate and returns it | 36 // Must be called on IO thread. Creates a delegate and returns it |
36 // synchronously or asynchronously to |callback|. If the delegate could not be | 37 // synchronously or asynchronously to |callback|. If the delegate could not be |
37 // created, |callback| is called with NULL. | 38 // created, |callback| is called with NULL. |
38 static void CreateForResourceContext( | 39 static void CreateForResourceContext( |
mattm
2014/10/18 00:45:16
update name
pneubeck (no reviews)
2014/10/21 09:22:09
Done.
| |
39 chrome::CryptoModulePasswordReason reason, | 40 chrome::CryptoModulePasswordReason reason, |
40 const net::HostPortPair& server, | 41 const net::HostPortPair& server, |
41 content::ResourceContext* context, | 42 cert_database::CertDatabaseServiceIOPart* cert_db_io, |
42 const base::Callback<void(scoped_ptr<ChromeNSSCryptoModuleDelegate>)>& | 43 const base::Callback<void(scoped_ptr<ChromeNSSCryptoModuleDelegate>)>& |
43 callback); | 44 callback); |
44 | 45 |
45 // crypto::NSSCryptoModuleDelegate implementation. | 46 // crypto::NSSCryptoModuleDelegate implementation. |
46 virtual crypto::ScopedPK11Slot RequestSlot() override; | 47 virtual crypto::ScopedPK11Slot RequestSlot() override; |
47 | 48 |
48 // crypto::CryptoModuleBlockingPasswordDelegate implementation. | 49 // crypto::CryptoModuleBlockingPasswordDelegate implementation. |
49 virtual std::string RequestPassword(const std::string& slot_name, | 50 virtual std::string RequestPassword(const std::string& slot_name, |
50 bool retry, | 51 bool retry, |
51 bool* cancelled) override; | 52 bool* cancelled) override; |
(...skipping 20 matching lines...) Expand all Loading... | |
72 DISALLOW_COPY_AND_ASSIGN(ChromeNSSCryptoModuleDelegate); | 73 DISALLOW_COPY_AND_ASSIGN(ChromeNSSCryptoModuleDelegate); |
73 }; | 74 }; |
74 | 75 |
75 // Create a delegate which only handles unlocking slots. | 76 // Create a delegate which only handles unlocking slots. |
76 crypto::CryptoModuleBlockingPasswordDelegate* | 77 crypto::CryptoModuleBlockingPasswordDelegate* |
77 CreateCryptoModuleBlockingPasswordDelegate( | 78 CreateCryptoModuleBlockingPasswordDelegate( |
78 chrome::CryptoModulePasswordReason reason, | 79 chrome::CryptoModulePasswordReason reason, |
79 const net::HostPortPair& server); | 80 const net::HostPortPair& server); |
80 | 81 |
81 #endif // CHROME_BROWSER_UI_CRYPTO_MODULE_DELEGATE_NSS_H_ | 82 #endif // CHROME_BROWSER_UI_CRYPTO_MODULE_DELEGATE_NSS_H_ |
OLD | NEW |