Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2575)

Unified Diff: chrome/browser/chromeos/options/cert_library.cc

Issue 2886913004: Copy some x509_certificate_model_nss functions to src/chromeos (reland) (Closed)
Patch Set: Rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/options/cert_library.h ('k') | chromeos/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/options/cert_library.cc
diff --git a/chrome/browser/chromeos/options/cert_library.cc b/chrome/browser/chromeos/options/cert_library.cc
index c83924f7259cbd8a6b24581bb93f6c3a2a2af2ce..dad898a0bf7d724137238a15c4dbfd9b2fbbf65e 100644
--- a/chrome/browser/chromeos/options/cert_library.cc
+++ b/chrome/browser/chromeos/options/cert_library.cc
@@ -6,22 +6,18 @@
#include <algorithm>
-#include "base/command_line.h"
#include "base/i18n/string_compare.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list_threadsafe.h"
-#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h" // g_browser_process
-#include "chrome/common/chrome_switches.h"
-#include "chrome/common/net/x509_certificate_model.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/dbus/cryptohome_client.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/login/login_state.h"
+#include "chromeos/network/certificate_helper.h"
#include "chromeos/network/onc/onc_utils.h"
-#include "content/public/browser/browser_thread.h"
#include "crypto/nss_util.h"
#include "net/cert/cert_database.h"
#include "net/cert/nss_cert_database.h"
@@ -38,16 +34,23 @@ const char kRootCertificateTokenName[] = "Builtin Object Token";
base::string16 GetDisplayString(net::X509Certificate* cert,
bool hardware_backed) {
- std::string org;
+ std::string alt_text;
if (!cert->subject().organization_names.empty())
- org = cert->subject().organization_names[0];
- if (org.empty())
- org = cert->subject().GetDisplayName();
+ alt_text = cert->subject().organization_names[0];
+ if (alt_text.empty())
+ alt_text = cert->subject().GetDisplayName();
base::string16 issued_by = base::UTF8ToUTF16(
- x509_certificate_model::GetIssuerCommonName(cert->os_cert_handle(),
- org)); // alternative text
+ certificate::GetIssuerCommonName(cert->os_cert_handle(), alt_text));
+
base::string16 issued_to = base::UTF8ToUTF16(
- x509_certificate_model::GetCertNameOrNickname(cert->os_cert_handle()));
+ certificate::GetCertNameOrNickname(cert->os_cert_handle()));
+ base::string16 issued_to_ascii = base::UTF8ToUTF16(
+ certificate::GetCertAsciiNameOrNickname(cert->os_cert_handle()));
+ if (issued_to_ascii != issued_to) {
+ // Input contained encoded data, show original and decoded forms.
+ issued_to = l10n_util::GetStringFUTF16(IDS_CERT_INFO_IDN_VALUE_FORMAT,
+ issued_to_ascii, issued_to);
+ }
if (hardware_backed) {
return l10n_util::GetStringFUTF16(
@@ -198,7 +201,7 @@ int CertLibrary::GetUserCertIndexByPkcs11Id(
void CertLibrary::OnCertificatesLoaded(const net::CertificateList& cert_list,
bool initial_load) {
- CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
VLOG(1) << "CertLibrary::OnCertificatesLoaded: " << cert_list.size();
certs_.clear();
user_certs_.clear();
@@ -211,7 +214,7 @@ void CertLibrary::OnCertificatesLoaded(const net::CertificateList& cert_list,
certs_.push_back(iter->get());
net::X509Certificate::OSCertHandle cert_handle =
iter->get()->os_cert_handle();
- net::CertType type = x509_certificate_model::GetType(cert_handle);
+ net::CertType type = certificate::GetCertType(cert_handle);
switch (type) {
case net::USER_CERT:
user_certs_.push_back(iter->get());
@@ -221,8 +224,7 @@ void CertLibrary::OnCertificatesLoaded(const net::CertificateList& cert_list,
break;
case net::CA_CERT: {
// Exclude root CA certificates that are built into Chrome.
- std::string token_name =
- x509_certificate_model::GetTokenName(cert_handle);
+ std::string token_name = certificate::GetCertTokenName(cert_handle);
if (token_name != kRootCertificateTokenName)
server_ca_certs_.push_back(iter->get());
break;
« no previous file with comments | « chrome/browser/chromeos/options/cert_library.h ('k') | chromeos/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698