Home | History | Annotate | Download | only in base
      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
      3 // found in the LICENSE file.
      4 
      5 #include "net/base/ssl_info.h"
      6 
      7 #include "net/base/cert_status_flags.h"
      8 #include "net/base/x509_certificate.h"
      9 
     10 namespace net {
     11 
     12 SSLInfo::SSLInfo()
     13     : cert_status(0),
     14       security_bits(-1),
     15       connection_status(0),
     16       is_issued_by_known_root(false) {
     17 }
     18 
     19 SSLInfo::SSLInfo(const SSLInfo& info)
     20     : cert(info.cert),
     21       cert_status(info.cert_status),
     22       security_bits(info.security_bits),
     23       connection_status(info.connection_status),
     24       is_issued_by_known_root(info.is_issued_by_known_root),
     25       public_key_hashes(info.public_key_hashes) {
     26 }
     27 
     28 SSLInfo::~SSLInfo() {
     29 }
     30 
     31 SSLInfo& SSLInfo::operator=(const SSLInfo& info) {
     32   cert = info.cert;
     33   cert_status = info.cert_status;
     34   security_bits = info.security_bits;
     35   connection_status = info.connection_status;
     36   public_key_hashes = info.public_key_hashes;
     37   is_issued_by_known_root = info.is_issued_by_known_root;
     38   return *this;
     39 }
     40 
     41 void SSLInfo::Reset() {
     42   cert = NULL;
     43   cert_status = 0;
     44   security_bits = -1;
     45   connection_status = 0;
     46   is_issued_by_known_root = false;
     47   public_key_hashes.clear();
     48 }
     49 
     50 void SSLInfo::SetCertError(int error) {
     51   cert_status |= MapNetErrorToCertStatus(error);
     52 }
     53 
     54 }  // namespace net
     55