Chromium Code Reviews| 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 | |
|
sky
2013/12/11 00:26:00
Add description.
mattm
2013/12/11 01:10:46
Done.
| |
| 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); | |
| 27 | |
| 28 virtual ~ChromeNSSCryptoModuleDelegate(); | |
| 29 | |
| 30 // Must be called on IO thread. Returns true if the delegate is ready for use. | |
| 31 // Otherwise, if |initialization_complete_callback| is non-null, the | |
| 32 // initialization will proceed asynchronously and the callback will be run | |
| 33 // once the delegate is ready to use. | |
| 34 bool InitializeSlot(content::ResourceContext* context, | |
| 35 const base::Closure& initialization_complete_callback) | |
| 36 WARN_UNUSED_RESULT; | |
| 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_; | |
|
sky
2013/12/11 00:26:00
Add descriptions for members and make const where
mattm
2013/12/11 01:10:46
Done.
| |
| 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 crypto::CryptoModuleBlockingPasswordDelegate* | |
| 64 CreateCryptoModuleBlockingPasswordDelegate( | |
| 65 chrome::CryptoModulePasswordReason reason, | |
| 66 const std::string& server); | |
| 67 | |
| 68 #endif // CHROME_BROWSER_UI_CRYPTO_MODULE_DELEGATE_NSS_H_ | |
| OLD | NEW |