Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / chrome / browser / ssl / certificate_error_report.h
blob61830dcd28fdd70262988207d637a6637ce27543
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SSL_CERTIFICATE_ERROR_REPORT_H_
6 #define CHROME_BROWSER_SSL_CERTIFICATE_ERROR_REPORT_H_
8 #include <string>
10 #include "base/memory/scoped_ptr.h"
12 namespace net {
13 class SSLInfo;
14 } // namespace net
16 class CertLoggerRequest;
18 // This class builds and serializes reports for invalid SSL certificate
19 // chains, intended to be sent with
20 // chrome_browser_net::CertificateErrorReporter.
21 class CertificateErrorReport {
22 public:
23 // Describes the type of interstitial that the user was shown for the
24 // error that this report represents. Gets mapped to
25 // |CertLoggerInterstitialInfo::InterstitialReason|.
26 enum InterstitialReason {
27 INTERSTITIAL_SSL,
28 INTERSTITIAL_CAPTIVE_PORTAL,
29 INTERSTITIAL_CLOCK
32 // Whether the user clicked through the interstitial or not.
33 enum ProceedDecision { USER_PROCEEDED, USER_DID_NOT_PROCEED };
35 // Whether the user was shown an option to click through the
36 // interstitial.
37 enum Overridable { INTERSTITIAL_OVERRIDABLE, INTERSTITIAL_NOT_OVERRIDABLE };
39 // Constructs an empty report.
40 CertificateErrorReport();
42 // Constructs a report for the given |hostname| using the SSL
43 // properties in |ssl_info|.
44 CertificateErrorReport(const std::string& hostname,
45 const net::SSLInfo& ssl_info);
47 ~CertificateErrorReport();
49 // Initializes an empty report by parsing the given serialized
50 // report. |serialized_report| should be a serialized
51 // CertLoggerRequest protobuf. Returns true if the report could be
52 // successfully parsed and false otherwise.
53 bool InitializeFromString(const std::string& serialized_report);
55 // Serializes the report. The output will be a serialized
56 // CertLoggerRequest protobuf. Returns true if the serialization was
57 // successful and false otherwise.
58 bool Serialize(std::string* output) const;
60 void SetInterstitialInfo(const InterstitialReason& interstitial_reason,
61 const ProceedDecision& proceed_decision,
62 const Overridable& overridable);
64 // Gets the hostname to which this report corresponds.
65 const std::string& hostname() const;
67 private:
68 scoped_ptr<CertLoggerRequest> cert_report_;
71 #endif // CHROME_BROWSER_SSL_CERTIFICATE_ERROR_REPORT_H_