| 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 "components/certificate_reporting/error_report.h" | 5 #include "components/certificate_reporting/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/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 return cert_report_->ParseFromString(serialized_report); | 93 return cert_report_->ParseFromString(serialized_report); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool ErrorReport::Serialize(std::string* output) const { | 96 bool ErrorReport::Serialize(std::string* output) const { |
| 97 return cert_report_->SerializeToString(output); | 97 return cert_report_->SerializeToString(output); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void ErrorReport::SetInterstitialInfo( | 100 void ErrorReport::SetInterstitialInfo( |
| 101 const InterstitialReason& interstitial_reason, | 101 const InterstitialReason& interstitial_reason, |
| 102 const ProceedDecision& proceed_decision, | 102 const ProceedDecision& proceed_decision, |
| 103 const Overridable& overridable) { | 103 const Overridable& overridable, |
| 104 const base::Time& interstitial_time) { |
| 104 CertLoggerInterstitialInfo* interstitial_info = | 105 CertLoggerInterstitialInfo* interstitial_info = |
| 105 cert_report_->mutable_interstitial_info(); | 106 cert_report_->mutable_interstitial_info(); |
| 106 | 107 |
| 107 switch (interstitial_reason) { | 108 switch (interstitial_reason) { |
| 108 case INTERSTITIAL_SSL: | 109 case INTERSTITIAL_SSL: |
| 109 interstitial_info->set_interstitial_reason( | 110 interstitial_info->set_interstitial_reason( |
| 110 CertLoggerInterstitialInfo::INTERSTITIAL_SSL); | 111 CertLoggerInterstitialInfo::INTERSTITIAL_SSL); |
| 111 break; | 112 break; |
| 112 case INTERSTITIAL_CAPTIVE_PORTAL: | 113 case INTERSTITIAL_CAPTIVE_PORTAL: |
| 113 interstitial_info->set_interstitial_reason( | 114 interstitial_info->set_interstitial_reason( |
| 114 CertLoggerInterstitialInfo::INTERSTITIAL_CAPTIVE_PORTAL); | 115 CertLoggerInterstitialInfo::INTERSTITIAL_CAPTIVE_PORTAL); |
| 115 break; | 116 break; |
| 116 case INTERSTITIAL_CLOCK: | 117 case INTERSTITIAL_CLOCK: |
| 117 interstitial_info->set_interstitial_reason( | 118 interstitial_info->set_interstitial_reason( |
| 118 CertLoggerInterstitialInfo::INTERSTITIAL_CLOCK); | 119 CertLoggerInterstitialInfo::INTERSTITIAL_CLOCK); |
| 119 break; | 120 break; |
| 120 } | 121 } |
| 121 | 122 |
| 122 interstitial_info->set_user_proceeded(proceed_decision == USER_PROCEEDED); | 123 interstitial_info->set_user_proceeded(proceed_decision == USER_PROCEEDED); |
| 123 interstitial_info->set_overridable(overridable == INTERSTITIAL_OVERRIDABLE); | 124 interstitial_info->set_overridable(overridable == INTERSTITIAL_OVERRIDABLE); |
| 125 interstitial_info->set_interstitial_created_time_usec( |
| 126 interstitial_time.ToInternalValue()); |
| 124 } | 127 } |
| 125 | 128 |
| 126 void ErrorReport::AddNetworkTimeInfo( | 129 void ErrorReport::AddNetworkTimeInfo( |
| 127 const NetworkTimeTracker* network_time_tracker) { | 130 const NetworkTimeTracker* network_time_tracker) { |
| 128 CertLoggerFeaturesInfo* features_info = cert_report_->mutable_features_info(); | 131 CertLoggerFeaturesInfo* features_info = cert_report_->mutable_features_info(); |
| 129 CertLoggerFeaturesInfo::NetworkTimeQueryingInfo* network_time_info = | 132 CertLoggerFeaturesInfo::NetworkTimeQueryingInfo* network_time_info = |
| 130 features_info->mutable_network_time_querying_info(); | 133 features_info->mutable_network_time_querying_info(); |
| 131 network_time_info->set_network_time_queries_enabled( | 134 network_time_info->set_network_time_queries_enabled( |
| 132 network_time_tracker->AreTimeFetchesEnabled()); | 135 network_time_tracker->AreTimeFetchesEnabled()); |
| 133 NetworkTimeTracker::FetchBehavior behavior = | 136 NetworkTimeTracker::FetchBehavior behavior = |
| (...skipping 21 matching lines...) Expand all Loading... |
| 155 break; | 158 break; |
| 156 } | 159 } |
| 157 network_time_info->set_network_time_query_behavior(report_behavior); | 160 network_time_info->set_network_time_query_behavior(report_behavior); |
| 158 } | 161 } |
| 159 | 162 |
| 160 const std::string& ErrorReport::hostname() const { | 163 const std::string& ErrorReport::hostname() const { |
| 161 return cert_report_->hostname(); | 164 return cert_report_->hostname(); |
| 162 } | 165 } |
| 163 | 166 |
| 164 } // namespace certificate_reporting | 167 } // namespace certificate_reporting |
| OLD | NEW |