weblayer_security_blocking_page_factory.h 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. // Copyright 2020 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. #ifndef WEBLAYER_BROWSER_WEBLAYER_SECURITY_BLOCKING_PAGE_FACTORY_H_
  5. #define WEBLAYER_BROWSER_WEBLAYER_SECURITY_BLOCKING_PAGE_FACTORY_H_
  6. #include "build/build_config.h"
  7. #include "components/captive_portal/core/buildflags.h"
  8. #include "components/security_interstitials/content/bad_clock_blocking_page.h"
  9. #include "components/security_interstitials/content/blocked_interception_blocking_page.h"
  10. #include "components/security_interstitials/content/captive_portal_blocking_page.h"
  11. #include "components/security_interstitials/content/https_only_mode_blocking_page.h"
  12. #include "components/security_interstitials/content/insecure_form_blocking_page.h"
  13. #include "components/security_interstitials/content/mitm_software_blocking_page.h"
  14. #include "components/security_interstitials/content/security_blocking_page_factory.h"
  15. #include "components/security_interstitials/content/ssl_blocking_page.h"
  16. #include "components/security_interstitials/content/ssl_blocking_page_base.h"
  17. namespace weblayer {
  18. // //weblayer's implementation of the SecurityBlockingPageFactory interface.
  19. class WebLayerSecurityBlockingPageFactory : public SecurityBlockingPageFactory {
  20. public:
  21. WebLayerSecurityBlockingPageFactory() = default;
  22. ~WebLayerSecurityBlockingPageFactory() override = default;
  23. WebLayerSecurityBlockingPageFactory(
  24. const WebLayerSecurityBlockingPageFactory&) = delete;
  25. WebLayerSecurityBlockingPageFactory& operator=(
  26. const WebLayerSecurityBlockingPageFactory&) = delete;
  27. // SecurityBlockingPageFactory:
  28. std::unique_ptr<SSLBlockingPage> CreateSSLPage(
  29. content::WebContents* web_contents,
  30. int cert_error,
  31. const net::SSLInfo& ssl_info,
  32. const GURL& request_url,
  33. int options_mask,
  34. const base::Time& time_triggered,
  35. const GURL& support_url,
  36. std::unique_ptr<SSLCertReporter> ssl_cert_reporter) override;
  37. std::unique_ptr<CaptivePortalBlockingPage> CreateCaptivePortalBlockingPage(
  38. content::WebContents* web_contents,
  39. const GURL& request_url,
  40. const GURL& login_url,
  41. std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
  42. const net::SSLInfo& ssl_info,
  43. int cert_error) override;
  44. std::unique_ptr<BadClockBlockingPage> CreateBadClockBlockingPage(
  45. content::WebContents* web_contents,
  46. int cert_error,
  47. const net::SSLInfo& ssl_info,
  48. const GURL& request_url,
  49. const base::Time& time_triggered,
  50. ssl_errors::ClockState clock_state,
  51. std::unique_ptr<SSLCertReporter> ssl_cert_reporter) override;
  52. std::unique_ptr<MITMSoftwareBlockingPage> CreateMITMSoftwareBlockingPage(
  53. content::WebContents* web_contents,
  54. int cert_error,
  55. const GURL& request_url,
  56. std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
  57. const net::SSLInfo& ssl_info,
  58. const std::string& mitm_software_name) override;
  59. std::unique_ptr<BlockedInterceptionBlockingPage>
  60. CreateBlockedInterceptionBlockingPage(
  61. content::WebContents* web_contents,
  62. int cert_error,
  63. const GURL& request_url,
  64. std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
  65. const net::SSLInfo& ssl_info) override;
  66. std::unique_ptr<security_interstitials::InsecureFormBlockingPage>
  67. CreateInsecureFormBlockingPage(content::WebContents* web_contents,
  68. const GURL& request_url) override;
  69. std::unique_ptr<security_interstitials::HttpsOnlyModeBlockingPage>
  70. CreateHttpsOnlyModeBlockingPage(content::WebContents* web_contents,
  71. const GURL& request_url) override;
  72. #if BUILDFLAG(IS_ANDROID)
  73. // Returns the URL that will be navigated to when the user clicks on the
  74. // "Connect" button of the captive portal interstitial. Used by tests to
  75. // verify this flow.
  76. static GURL GetCaptivePortalLoginPageUrlForTesting();
  77. #endif
  78. };
  79. } // namespace weblayer
  80. #endif // WEBLAYER_BROWSER_WEBLAYER_SECURITY_BLOCKING_PAGE_FACTORY_H_