// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/ssl/ssl_error_info.h" #include "base/utf_string_conversions.h" #include "chrome/common/time_format.h" #include "content/browser/cert_store.h" #include "googleurl/src/gurl.h" #include "grit/chromium_strings.h" #include "grit/generated_resources.h" #include "net/base/cert_status_flags.h" #include "net/base/net_errors.h" #include "net/base/ssl_info.h" #include "ui/base/l10n/l10n_util.h" SSLErrorInfo::SSLErrorInfo(const string16& title, const string16& details, const string16& short_description, const std::vector& extra_info) : title_(title), details_(details), short_description_(short_description), extra_information_(extra_info) { } // static SSLErrorInfo SSLErrorInfo::CreateError(ErrorType error_type, net::X509Certificate* cert, const GURL& request_url) { string16 title, details, short_description; std::vector extra_info; switch (error_type) { case CERT_COMMON_NAME_INVALID: { title = l10n_util::GetStringUTF16(IDS_CERT_ERROR_COMMON_NAME_INVALID_TITLE); // If the certificate contains multiple DNS names, we choose the most // representative one -- either the DNS name that's also in the subject // field, or the first one. If this heuristic turns out to be // inadequate, we can consider choosing the DNS name that is the // "closest match" to the host name in the request URL, or listing all // the DNS names with an HTML