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 #include "chrome/browser/ui/crypto_module_delegate_nss.h" | 5 #include "chrome/browser/ui/crypto_module_delegate_nss.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "chrome/browser/net/nss_context.h" | 10 #include "chrome/browser/net/nss_context.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 } | 68 } |
69 | 69 |
70 std::string ChromeNSSCryptoModuleDelegate::RequestPassword( | 70 std::string ChromeNSSCryptoModuleDelegate::RequestPassword( |
71 const std::string& slot_name, | 71 const std::string& slot_name, |
72 bool retry, | 72 bool retry, |
73 bool* cancelled) { | 73 bool* cancelled) { |
74 DCHECK(!event_.IsSignaled()); | 74 DCHECK(!event_.IsSignaled()); |
75 event_.Reset(); | 75 event_.Reset(); |
76 | 76 |
77 if (BrowserThread::PostTask( | 77 if (BrowserThread::PostTask( |
78 BrowserThread::UI, | 78 BrowserThread::UI, FROM_HERE, |
79 FROM_HERE, | 79 base::BindOnce( |
80 base::Bind(&ChromeNSSCryptoModuleDelegate::ShowDialog, | 80 &ChromeNSSCryptoModuleDelegate::ShowDialog, |
81 // This method blocks on |event_| until the task completes, | 81 // This method blocks on |event_| until the task completes, |
82 // so there's no need to ref-count. | 82 // so there's no need to ref-count. |
83 base::Unretained(this), | 83 base::Unretained(this), slot_name, retry))) { |
84 slot_name, | |
85 retry))) { | |
86 event_.Wait(); | 84 event_.Wait(); |
87 } | 85 } |
88 *cancelled = cancelled_; | 86 *cancelled = cancelled_; |
89 return password_; | 87 return password_; |
90 } | 88 } |
91 | 89 |
92 void ChromeNSSCryptoModuleDelegate::ShowDialog(const std::string& slot_name, | 90 void ChromeNSSCryptoModuleDelegate::ShowDialog(const std::string& slot_name, |
93 bool retry) { | 91 bool retry) { |
94 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 92 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
95 ShowCryptoModulePasswordDialog( | 93 ShowCryptoModulePasswordDialog( |
(...skipping 19 matching lines...) Expand all Loading... |
115 crypto::CryptoModuleBlockingPasswordDelegate* | 113 crypto::CryptoModuleBlockingPasswordDelegate* |
116 CreateCryptoModuleBlockingPasswordDelegate( | 114 CreateCryptoModuleBlockingPasswordDelegate( |
117 chrome::CryptoModulePasswordReason reason, | 115 chrome::CryptoModulePasswordReason reason, |
118 const net::HostPortPair& server) { | 116 const net::HostPortPair& server) { |
119 // Returns a ChromeNSSCryptoModuleDelegate without Pk11Slot. Since it is only | 117 // Returns a ChromeNSSCryptoModuleDelegate without Pk11Slot. Since it is only |
120 // being used as a CryptoModuleBlockingDialogDelegate, using a slot handle is | 118 // being used as a CryptoModuleBlockingDialogDelegate, using a slot handle is |
121 // unnecessary. | 119 // unnecessary. |
122 return new ChromeNSSCryptoModuleDelegate( | 120 return new ChromeNSSCryptoModuleDelegate( |
123 reason, server, crypto::ScopedPK11Slot()); | 121 reason, server, crypto::ScopedPK11Slot()); |
124 } | 122 } |
OLD | NEW |