Index: components/certificate_reporting/error_report.cc |
diff --git a/components/certificate_reporting/error_report.cc b/components/certificate_reporting/error_report.cc |
index 18145e70005e5d6348615360706fc26ad400685e..ee6cef8d0bedc234cc7da38f344d15a9ceea978f 100644 |
--- a/components/certificate_reporting/error_report.cc |
+++ b/components/certificate_reporting/error_report.cc |
@@ -4,12 +4,16 @@ |
#include "components/certificate_reporting/error_report.h" |
+#include <map> |
+#include <string> |
#include <vector> |
+#include "base/feature_list.h" |
#include "base/stl_util.h" |
#include "base/strings/string_util.h" |
#include "base/time/time.h" |
#include "components/certificate_reporting/cert_logger.pb.h" |
+#include "components/variations/variations_associated_data.h" |
#include "net/cert/cert_status_flags.h" |
#include "net/cert/x509_certificate.h" |
#include "net/ssl/ssl_info.h" |
@@ -124,4 +128,20 @@ const std::string& ErrorReport::hostname() const { |
return cert_report_->hostname(); |
} |
+void ErrorReport::AddFeature(const base::Feature& feature) { |
+ CertLoggerFeatureInfo* report_feature = cert_report_->add_features_info(); |
+ report_feature->set_feature(feature.name); |
+ report_feature->set_enabled(base::FeatureList::IsEnabled(feature)); |
+ std::map<std::string, std::string> params; |
+ if (!variations::GetVariationParamsByFeature(feature, ¶ms)) { |
+ // Feature is not enabled or there are no params. |
+ return; |
+ } |
+ for (const auto& param : params) { |
+ CertLoggerFeatureInfo::Parameter* parameter = report_feature->add_params(); |
+ parameter->set_name(param.first); |
+ parameter->set_value(param.second); |
+ } |
+} |
+ |
} // namespace certificate_reporting |