OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ssl/ssl_client_certificate_selector.h" | 5 #include "chrome/browser/ssl/ssl_client_certificate_selector.h" |
6 | 6 |
7 #include <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 cert_request_info()->client_certs.size())) | 242 cert_request_info()->client_certs.size())) |
243 return cert_request_info()->client_certs[selected]; | 243 return cert_request_info()->client_certs[selected]; |
244 return NULL; | 244 return NULL; |
245 } | 245 } |
246 | 246 |
247 // static | 247 // static |
248 std::string SSLClientCertificateSelector::FormatComboBoxText( | 248 std::string SSLClientCertificateSelector::FormatComboBoxText( |
249 net::X509Certificate::OSCertHandle cert, const std::string& nickname) { | 249 net::X509Certificate::OSCertHandle cert, const std::string& nickname) { |
250 std::string rv(nickname); | 250 std::string rv(nickname); |
251 rv += " ["; | 251 rv += " ["; |
252 rv += x509_certificate_model::GetSerialNumberHexified(cert, ""); | 252 rv += x509_certificate_model::GetSerialNumberHexified(cert, std::string()); |
253 rv += ']'; | 253 rv += ']'; |
254 return rv; | 254 return rv; |
255 } | 255 } |
256 | 256 |
257 // static | 257 // static |
258 std::string SSLClientCertificateSelector::FormatDetailsText( | 258 std::string SSLClientCertificateSelector::FormatDetailsText( |
259 net::X509Certificate::OSCertHandle cert) { | 259 net::X509Certificate::OSCertHandle cert) { |
260 std::string rv; | 260 std::string rv; |
261 | 261 |
262 rv += l10n_util::GetStringFUTF8( | 262 rv += l10n_util::GetStringFUTF8( |
263 IDS_CERT_SUBJECTNAME_FORMAT, | 263 IDS_CERT_SUBJECTNAME_FORMAT, |
264 UTF8ToUTF16(x509_certificate_model::GetSubjectName(cert))); | 264 UTF8ToUTF16(x509_certificate_model::GetSubjectName(cert))); |
265 | 265 |
266 rv += "\n "; | 266 rv += "\n "; |
267 rv += l10n_util::GetStringFUTF8( | 267 rv += l10n_util::GetStringFUTF8( |
268 IDS_CERT_SERIAL_NUMBER_FORMAT, | 268 IDS_CERT_SERIAL_NUMBER_FORMAT, |
269 UTF8ToUTF16( | 269 UTF8ToUTF16(x509_certificate_model::GetSerialNumberHexified( |
270 x509_certificate_model::GetSerialNumberHexified(cert, ""))); | 270 cert, std::string()))); |
271 | 271 |
272 base::Time issued, expires; | 272 base::Time issued, expires; |
273 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { | 273 if (x509_certificate_model::GetTimes(cert, &issued, &expires)) { |
274 string16 issued_str = base::TimeFormatShortDateAndTime(issued); | 274 string16 issued_str = base::TimeFormatShortDateAndTime(issued); |
275 string16 expires_str = base::TimeFormatShortDateAndTime(expires); | 275 string16 expires_str = base::TimeFormatShortDateAndTime(expires); |
276 rv += "\n "; | 276 rv += "\n "; |
277 rv += l10n_util::GetStringFUTF8(IDS_CERT_VALIDITY_RANGE_FORMAT, | 277 rv += l10n_util::GetStringFUTF8(IDS_CERT_VALIDITY_RANGE_FORMAT, |
278 issued_str, expires_str); | 278 issued_str, expires_str); |
279 } | 279 } |
280 | 280 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 content::WebContents* contents, | 388 content::WebContents* contents, |
389 const net::HttpNetworkSession* network_session, | 389 const net::HttpNetworkSession* network_session, |
390 net::SSLCertRequestInfo* cert_request_info, | 390 net::SSLCertRequestInfo* cert_request_info, |
391 const base::Callback<void(net::X509Certificate*)>& callback) { | 391 const base::Callback<void(net::X509Certificate*)>& callback) { |
392 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 392 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
393 (new SSLClientCertificateSelector( | 393 (new SSLClientCertificateSelector( |
394 contents, network_session, cert_request_info, callback))->Show(); | 394 contents, network_session, cert_request_info, callback))->Show(); |
395 } | 395 } |
396 | 396 |
397 } // namespace chrome | 397 } // namespace chrome |
OLD | NEW |