OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ssl/certificate_error_report.h" | 5 #include "chrome/browser/ssl/certificate_error_report.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 bool CertificateErrorReport::InitializeFromString( | 81 bool CertificateErrorReport::InitializeFromString( |
82 const std::string& serialized_report) { | 82 const std::string& serialized_report) { |
83 return cert_report_->ParseFromString(serialized_report); | 83 return cert_report_->ParseFromString(serialized_report); |
84 } | 84 } |
85 | 85 |
86 bool CertificateErrorReport::Serialize(std::string* output) const { | 86 bool CertificateErrorReport::Serialize(std::string* output) const { |
87 return cert_report_->SerializeToString(output); | 87 return cert_report_->SerializeToString(output); |
88 } | 88 } |
89 | 89 |
| 90 void CertificateErrorReport::SetInterstitialInfo( |
| 91 const InterstitialReason& interstitial_reason, |
| 92 const ProceedDecision& proceed_decision, |
| 93 const Overridable& overridable) { |
| 94 CertLoggerInterstitialInfo* interstitial_info = |
| 95 cert_report_->mutable_interstitial_info(); |
| 96 |
| 97 switch (interstitial_reason) { |
| 98 case INTERSTITIAL_SSL: |
| 99 interstitial_info->set_interstitial_reason( |
| 100 CertLoggerInterstitialInfo::INTERSTITIAL_SSL); |
| 101 break; |
| 102 case INTERSTITIAL_CAPTIVE_PORTAL: |
| 103 interstitial_info->set_interstitial_reason( |
| 104 CertLoggerInterstitialInfo::INTERSTITIAL_CAPTIVE_PORTAL); |
| 105 break; |
| 106 case INTERSTITIAL_CLOCK: |
| 107 interstitial_info->set_interstitial_reason( |
| 108 CertLoggerInterstitialInfo::INTERSTITIAL_CLOCK); |
| 109 break; |
| 110 } |
| 111 |
| 112 interstitial_info->set_user_proceeded(proceed_decision == USER_PROCEEDED); |
| 113 interstitial_info->set_overridable(overridable == INTERSTITIAL_OVERRIDABLE); |
| 114 } |
| 115 |
90 const std::string& CertificateErrorReport::hostname() const { | 116 const std::string& CertificateErrorReport::hostname() const { |
91 return cert_report_->hostname(); | 117 return cert_report_->hostname(); |
92 } | 118 } |
OLD | NEW |