summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authordavidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-02 21:26:11 +0000
committerdavidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-02 21:26:11 +0000
commit4a729ae7ff3f615214d2120a2218a5bef4742c58 (patch)
tree0b1adbf4970808323a2c564abd58780bf3f87c71 /net
parent0107dbdf9eaa3d5c60d070c1ccfaee2972bdfec3 (diff)
downloadchromium_src-4a729ae7ff3f615214d2120a2218a5bef4742c58.zip
chromium_src-4a729ae7ff3f615214d2120a2218a5bef4742c58.tar.gz
chromium_src-4a729ae7ff3f615214d2120a2218a5bef4742c58.tar.bz2
Display an infobar after enrolling a client certificate
This gives the user some feedback that we added a certificate. R=wtc,brettw TEST=none BUG=50782 Review URL: http://codereview.chromium.org/2815023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54602 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/x509_cert_types.cc11
-rw-r--r--net/base/x509_cert_types.h4
2 files changed, 15 insertions, 0 deletions
diff --git a/net/base/x509_cert_types.cc b/net/base/x509_cert_types.cc
index 8f7a2ae..9c1369d 100644
--- a/net/base/x509_cert_types.cc
+++ b/net/base/x509_cert_types.cc
@@ -49,6 +49,17 @@ bool CertPrincipal::Matches(const CertPrincipal& against) const {
match(domain_components, against.domain_components);
}
+std::string CertPrincipal::GetDisplayName() const {
+ if (!common_name.empty())
+ return common_name;
+ if (!organization_names.empty())
+ return organization_names[0];
+ if (!organization_unit_names.empty())
+ return organization_unit_names[0];
+
+ return std::string();
+}
+
std::ostream& operator<<(std::ostream& s, const CertPrincipal& p) {
s << "CertPrincipal[";
if (!p.common_name.empty())
diff --git a/net/base/x509_cert_types.h b/net/base/x509_cert_types.h
index 8693ba9..1a788a7d 100644
--- a/net/base/x509_cert_types.h
+++ b/net/base/x509_cert_types.h
@@ -69,6 +69,10 @@ struct CertPrincipal {
// where "match" is defined in RFC 5280 sec. 7.1.
bool Matches(const CertPrincipal& against) const;
+ // Returns a name that can be used to represent the issuer. It tries in this
+ // order: CN, O and OU and returns the first non-empty one found.
+ std::string GetDisplayName() const;
+
// The different attributes for a principal. They may be "".
// Note that some of them can have several values.