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

Side by Side Diff: chrome/browser/ssl/chrome_expect_ct_reporter.cc

Issue 2120683002: Fix up certificate error reporting histograms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove unused ios certificate_reporting dependency Created 4 years, 5 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chrome_expect_ct_reporter.h" 5 #include "chrome/browser/ssl/chrome_expect_ct_reporter.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 sct->SetString("extensions", extensions); 98 sct->SetString("extensions", extensions);
99 std::string signature; 99 std::string signature;
100 base::Base64Encode(sct_and_status.sct->signature.signature_data, &signature); 100 base::Base64Encode(sct_and_status.sct->signature.signature_data, &signature);
101 sct->SetString("signature", signature); 101 sct->SetString("signature", signature);
102 102
103 list_item->Set("sct", std::move(sct)); 103 list_item->Set("sct", std::move(sct));
104 list->Append(std::move(list_item)); 104 list->Append(std::move(list_item));
105 } 105 }
106 106
107 // Records an UMA histogram of the net errors when Expect CT reports 107 // Records an UMA histogram of the net errors when Expect CT reports
108 // fails to send. 108 // fail to send.
109 void RecordUMAOnFailure(const GURL& report_uri, int net_error) { 109 void RecordUMAOnFailure(const GURL& report_uri, int net_error) {
110 UMA_HISTOGRAM_SPARSE_SLOWLY("SSL.ExpectCTReportFailure", net_error); 110 UMA_HISTOGRAM_SPARSE_SLOWLY("SSL.ExpectCTReportFailure2", -net_error);
111 } 111 }
112 112
113 } // namespace 113 } // namespace
114 114
115 ChromeExpectCTReporter::ChromeExpectCTReporter( 115 ChromeExpectCTReporter::ChromeExpectCTReporter(
116 net::URLRequestContext* request_context) 116 net::URLRequestContext* request_context)
117 : report_sender_( 117 : report_sender_(
118 new net::ReportSender(request_context, 118 new net::ReportSender(request_context,
119 net::ReportSender::DO_NOT_SEND_COOKIES, 119 net::ReportSender::DO_NOT_SEND_COOKIES,
120 base::Bind(RecordUMAOnFailure))) {} 120 base::Bind(RecordUMAOnFailure))) {}
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 std::string serialized_report; 170 std::string serialized_report;
171 if (!base::JSONWriter::Write(report, &serialized_report)) { 171 if (!base::JSONWriter::Write(report, &serialized_report)) {
172 LOG(ERROR) << "Failed to serialize Expect CT report"; 172 LOG(ERROR) << "Failed to serialize Expect CT report";
173 return; 173 return;
174 } 174 }
175 175
176 UMA_HISTOGRAM_BOOLEAN("SSL.ExpectCTReportSendingAttempt", true); 176 UMA_HISTOGRAM_BOOLEAN("SSL.ExpectCTReportSendingAttempt", true);
177 177
178 report_sender_->Send(report_uri, serialized_report); 178 report_sender_->Send(report_uri, serialized_report);
179 } 179 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ssl/chrome_expect_ct_reporter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698