1 // Copyright 2017 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.
4 
5 #ifndef COMPONENTS_SECURITY_INTERSTITIALS_CORE_MITM_SOFTWARE_UI_H_
6 #define COMPONENTS_SECURITY_INTERSTITIALS_CORE_MITM_SOFTWARE_UI_H_
7 
8 #include "base/macros.h"
9 #include "base/values.h"
10 #include "components/security_interstitials/core/controller_client.h"
11 #include "components/ssl_errors/error_classification.h"
12 #include "net/ssl/ssl_info.h"
13 #include "url/gurl.h"
14 
15 namespace security_interstitials {
16 
17 // Provides UI for SSL errors caused by MITM software misconfigurations.
18 class MITMSoftwareUI {
19  public:
20   MITMSoftwareUI(const GURL& request_url,
21                  int cert_error,
22                  const net::SSLInfo& ssl_info,
23                  const std::string& mitm_software_name,
24                  bool is_enterprise_managed,
25                  ControllerClient* controller_);
26   ~MITMSoftwareUI();
27 
28   void PopulateStringsForHTML(base::DictionaryValue* load_time_data);
29   void HandleCommand(SecurityInterstitialCommand command);
30 
31  protected:
32   void PopulateEnterpriseUserStringsForHTML(
33       base::DictionaryValue* load_time_data);
34   void PopulateAtHomeUserStringsForHTML(base::DictionaryValue* load_time_data);
35 
36  private:
37   const GURL request_url_;
38   const int cert_error_;
39   const net::SSLInfo ssl_info_;
40   const std::string mitm_software_name_;
41   const bool is_enterprise_managed_;
42   ControllerClient* controller_;
43 
44   DISALLOW_COPY_AND_ASSIGN(MITMSoftwareUI);
45 };
46 
47 }  // namespace security_interstitials
48 
49 #endif  // COMPONENTS_SECURITY_INTERSTITIALS_CORE_MITM_SOFTWARE_UI_H
50