| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/chromeos/cros/cert_library.h" | 5 #include "chrome/browser/chromeos/cros/cert_library.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/observer_list_threadsafe.h" | 9 #include "base/observer_list_threadsafe.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // Delay between certificate requests while waiting for TPM/PKCS#11 init. | 29 // Delay between certificate requests while waiting for TPM/PKCS#11 init. |
| 30 const int kRequestDelayMs = 500; | 30 const int kRequestDelayMs = 500; |
| 31 | 31 |
| 32 string16 GetDisplayString(net::X509Certificate* cert, bool hardware_backed) { | 32 string16 GetDisplayString(net::X509Certificate* cert, bool hardware_backed) { |
| 33 std::string org; | 33 std::string org; |
| 34 if (!cert->subject().organization_names.empty()) | 34 if (!cert->subject().organization_names.empty()) |
| 35 org = cert->subject().organization_names[0]; | 35 org = cert->subject().organization_names[0]; |
| 36 if (org.empty()) | 36 if (org.empty()) |
| 37 org = cert->subject().GetDisplayName(); | 37 org = cert->subject().GetDisplayName(); |
| 38 string16 issued_by = UTF8ToUTF16(org); | 38 string16 issued_by = UTF8ToUTF16( |
| 39 x509_certificate_model::GetIssuerCommonName(cert->os_cert_handle(), |
| 40 org)); // alternative text |
| 39 string16 issued_to = UTF8ToUTF16( | 41 string16 issued_to = UTF8ToUTF16( |
| 40 x509_certificate_model::GetCertNameOrNickname(cert->os_cert_handle())); | 42 x509_certificate_model::GetCertNameOrNickname(cert->os_cert_handle())); |
| 41 | 43 |
| 42 if (hardware_backed) { | 44 if (hardware_backed) { |
| 43 return l10n_util::GetStringFUTF16( | 45 return l10n_util::GetStringFUTF16( |
| 44 IDS_CERT_MANAGER_HARDWARE_BACKED_KEY_FORMAT_LONG, | 46 IDS_CERT_MANAGER_HARDWARE_BACKED_KEY_FORMAT_LONG, |
| 45 issued_by, | 47 issued_by, |
| 46 issued_to, | 48 issued_to, |
| 47 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_HARDWARE_BACKED)); | 49 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_HARDWARE_BACKED)); |
| 48 } else { | 50 } else { |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 return index; | 399 return index; |
| 398 } | 400 } |
| 399 return -1; // Not found. | 401 return -1; // Not found. |
| 400 } | 402 } |
| 401 | 403 |
| 402 } // chromeos | 404 } // chromeos |
| 403 | 405 |
| 404 // Allows InvokeLater without adding refcounting. This class is a singleton and | 406 // Allows InvokeLater without adding refcounting. This class is a singleton and |
| 405 // won't be deleted until it's last InvokeLater is run. | 407 // won't be deleted until it's last InvokeLater is run. |
| 406 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::CertLibraryImpl); | 408 DISABLE_RUNNABLE_METHOD_REFCOUNT(chromeos::CertLibraryImpl); |
| OLD | NEW |