Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2153)

Unified Diff: components/certificate_reporting/error_report.cc

Issue 2448943004: Add experimental feature info to certificate reports (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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, &params)) {
+ // 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

Powered by Google App Engine
This is Rietveld 408576698