| 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/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 class ChromeNSSCryptoModuleDelegate | 23 class ChromeNSSCryptoModuleDelegate |
| 24 : public crypto::NSSCryptoModuleDelegate { | 24 : public crypto::NSSCryptoModuleDelegate { |
| 25 public: | 25 public: |
| 26 // Create a ChromeNSSCryptoModuleDelegate. |reason| is used to select what | 26 // Create a ChromeNSSCryptoModuleDelegate. |reason| is used to select what |
| 27 // string to show the user, |server| is displayed to indicate which connection | 27 // string to show the user, |server| is displayed to indicate which connection |
| 28 // is causing the dialog to appear. |slot| can be NULL. | 28 // is causing the dialog to appear. |slot| can be NULL. |
| 29 ChromeNSSCryptoModuleDelegate(chrome::CryptoModulePasswordReason reason, | 29 ChromeNSSCryptoModuleDelegate(chrome::CryptoModulePasswordReason reason, |
| 30 const net::HostPortPair& server, | 30 const net::HostPortPair& server, |
| 31 crypto::ScopedPK11Slot slot); | 31 crypto::ScopedPK11Slot slot); |
| 32 | 32 |
| 33 virtual ~ChromeNSSCryptoModuleDelegate(); | 33 ~ChromeNSSCryptoModuleDelegate() override; |
| 34 | 34 |
| 35 // Must be called on IO thread. Creates a delegate and returns it | 35 // Must be called on IO thread. Creates a delegate and returns it |
| 36 // synchronously or asynchronously to |callback|. If the delegate could not be | 36 // synchronously or asynchronously to |callback|. If the delegate could not be |
| 37 // created, |callback| is called with NULL. | 37 // created, |callback| is called with NULL. |
| 38 static void CreateForResourceContext( | 38 static void CreateForResourceContext( |
| 39 chrome::CryptoModulePasswordReason reason, | 39 chrome::CryptoModulePasswordReason reason, |
| 40 const net::HostPortPair& server, | 40 const net::HostPortPair& server, |
| 41 content::ResourceContext* context, | 41 content::ResourceContext* context, |
| 42 const base::Callback<void(scoped_ptr<ChromeNSSCryptoModuleDelegate>)>& | 42 const base::Callback<void(scoped_ptr<ChromeNSSCryptoModuleDelegate>)>& |
| 43 callback); | 43 callback); |
| 44 | 44 |
| 45 // crypto::NSSCryptoModuleDelegate implementation. | 45 // crypto::NSSCryptoModuleDelegate implementation. |
| 46 virtual crypto::ScopedPK11Slot RequestSlot() override; | 46 crypto::ScopedPK11Slot RequestSlot() override; |
| 47 | 47 |
| 48 // crypto::CryptoModuleBlockingPasswordDelegate implementation. | 48 // crypto::CryptoModuleBlockingPasswordDelegate implementation. |
| 49 virtual std::string RequestPassword(const std::string& slot_name, | 49 std::string RequestPassword(const std::string& slot_name, |
| 50 bool retry, | 50 bool retry, |
| 51 bool* cancelled) override; | 51 bool* cancelled) override; |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 void ShowDialog(const std::string& slot_name, bool retry); | 54 void ShowDialog(const std::string& slot_name, bool retry); |
| 55 | 55 |
| 56 void GotPassword(const std::string& password); | 56 void GotPassword(const std::string& password); |
| 57 | 57 |
| 58 // Parameters displayed in the dialog. | 58 // Parameters displayed in the dialog. |
| 59 const chrome::CryptoModulePasswordReason reason_; | 59 const chrome::CryptoModulePasswordReason reason_; |
| 60 net::HostPortPair server_; | 60 net::HostPortPair server_; |
| 61 | 61 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 72 DISALLOW_COPY_AND_ASSIGN(ChromeNSSCryptoModuleDelegate); | 72 DISALLOW_COPY_AND_ASSIGN(ChromeNSSCryptoModuleDelegate); |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 // Create a delegate which only handles unlocking slots. | 75 // Create a delegate which only handles unlocking slots. |
| 76 crypto::CryptoModuleBlockingPasswordDelegate* | 76 crypto::CryptoModuleBlockingPasswordDelegate* |
| 77 CreateCryptoModuleBlockingPasswordDelegate( | 77 CreateCryptoModuleBlockingPasswordDelegate( |
| 78 chrome::CryptoModulePasswordReason reason, | 78 chrome::CryptoModulePasswordReason reason, |
| 79 const net::HostPortPair& server); | 79 const net::HostPortPair& server); |
| 80 | 80 |
| 81 #endif // CHROME_BROWSER_UI_CRYPTO_MODULE_DELEGATE_NSS_H_ | 81 #endif // CHROME_BROWSER_UI_CRYPTO_MODULE_DELEGATE_NSS_H_ |
| OLD | NEW |