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

Unified Diff: chrome/browser/ssl/certificate_error_report.h

Issue 1117173004: Split cert reporter class into report building/serializing and sending (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: document parse/serialize return value Created 5 years, 7 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: chrome/browser/ssl/certificate_error_report.h
diff --git a/chrome/browser/ssl/certificate_error_report.h b/chrome/browser/ssl/certificate_error_report.h
new file mode 100644
index 0000000000000000000000000000000000000000..52a263d13b959496ec34a99e64a33f12e183a2bc
--- /dev/null
+++ b/chrome/browser/ssl/certificate_error_report.h
@@ -0,0 +1,55 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_SSL_CERTIFICATE_ERROR_REPORT_H_
+#define CHROME_BROWSER_SSL_CERTIFICATE_ERROR_REPORT_H_
+
+#include <string>
+
+#include "chrome/browser/ssl/cert_logger.pb.h"
Ryan Sleevi 2015/05/13 01:02:12 In general, including .pb.h in header files is a r
estark 2015/05/13 01:44:49 Good to know; I changed it to be a pointer member.
+
+namespace net {
+class SSLInfo;
+}; // namespace net
Ryan Sleevi 2015/05/13 01:02:12 no ;
estark 2015/05/13 01:44:49 Done.
+
+namespace chrome_browser_ssl {
+
+class CertLoggerRequest;
Ryan Sleevi 2015/05/13 01:02:12 You can't forward declare this, because line 50 ne
estark 2015/05/13 01:44:49 Changed line 50 to be a scoped_ptr
+
+// This class builds and serializes reports for invalid SSL certificate
+// chains, intended to be sent with
+// chrome_browser_net::CertificateErrorReporter.
+class CertificateErrorReport {
+ public:
+ // Constructs an empty report.
+ CertificateErrorReport();
+
+ // Constructs a report for the given |hostname| using the SSL
+ // properties in |ssl_info|.
+ CertificateErrorReport(const std::string& hostname,
+ const net::SSLInfo& ssl_info);
+
+ ~CertificateErrorReport();
+
+ // Initializes an empty report by parsing the given serialized
+ // report. |serialized_report| should be a serialized
+ // CertLoggerRequest protobuf. Returns true if the report could be
+ // successfully parsed and false otherwise.
+ bool InitializeFromString(const std::string& serialized_report);
+
+ // Serializes the report. The output will be a serialized
+ // CertLoggerRequest protobuf. Returns true if the serialization was
+ // successful and false otherwise.
+ bool Serialize(std::string* output) const;
+
+ // Gets the hostname to which this report corresponds.
+ const std::string& hostname() const;
+
+ private:
+ CertLoggerRequest cert_report_;
+};
+
+} // namespace chrome_browser_ssl
+
+#endif // CHROME_BROWSER_SSL_CERTIFICATE_ERROR_REPORT_H_

Powered by Google App Engine
This is Rietveld 408576698