safe_browsing_loud_error_ui.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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
  3. // found in the LICENSE file.
  4. #ifndef COMPONENTS_SECURITY_INTERSTITIALS_CORE_SAFE_BROWSING_LOUD_ERROR_UI_H_
  5. #define COMPONENTS_SECURITY_INTERSTITIALS_CORE_SAFE_BROWSING_LOUD_ERROR_UI_H_
  6. #include "base/time/time.h"
  7. #include "base/values.h"
  8. #include "components/security_interstitials/core/base_safe_browsing_error_ui.h"
  9. #include "components/security_interstitials/core/controller_client.h"
  10. #include "url/gurl.h"
  11. namespace security_interstitials {
  12. // Loud version of the safe browsing interstitial. This is the full screen
  13. // version of the interstitial used on Desktop, Android and iOS. It is
  14. // selectively used in parts of WebView.
  15. // This class displays UI for Safe Browsing errors that block page loads. This
  16. // class is purely about visual display; it does not do any error-handling logic
  17. // to determine what type of error should be displayed when.
  18. // |created_prior_to_navigation| should be set to true if this UI was created
  19. // prior to navigating to the error page (e.g. from WillFailResponse in a
  20. // navigation throttle), false otherwise.
  21. class SafeBrowsingLoudErrorUI
  22. : public security_interstitials::BaseSafeBrowsingErrorUI {
  23. public:
  24. SafeBrowsingLoudErrorUI(
  25. const GURL& request_url,
  26. const GURL& main_frame_url,
  27. BaseSafeBrowsingErrorUI::SBInterstitialReason reason,
  28. const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options,
  29. const std::string& app_locale,
  30. const base::Time& time_triggered,
  31. ControllerClient* controller,
  32. bool created_prior_to_navigation);
  33. SafeBrowsingLoudErrorUI(const SafeBrowsingLoudErrorUI&) = delete;
  34. SafeBrowsingLoudErrorUI& operator=(const SafeBrowsingLoudErrorUI&) = delete;
  35. ~SafeBrowsingLoudErrorUI() override;
  36. // Implement BaseSafeBrowsingErrorUI.
  37. void PopulateStringsForHtml(base::Value::Dict& load_time_data) override;
  38. void HandleCommand(SecurityInterstitialCommand command) override;
  39. int GetHTMLTemplateId() const override;
  40. private:
  41. // Fills the passed dictionary with the values to be passed to the template
  42. // when creating the HTML.
  43. void PopulateExtendedReportingOption(base::Value::Dict& load_time_data);
  44. void PopulateMalwareLoadTimeData(base::Value::Dict& load_time_data);
  45. void PopulateHarmfulLoadTimeData(base::Value::Dict& load_time_data);
  46. void PopulatePhishingLoadTimeData(base::Value::Dict& load_time_data);
  47. void PopulateBillingLoadTimeData(base::Value::Dict& load_time_data);
  48. void PopulateEnhancedProtectionMessage(base::Value::Dict& load_time_data);
  49. const bool created_prior_to_navigation_;
  50. };
  51. } // security_interstitials
  52. #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_SAFE_BROWSING_LOUD_ERROR_UI_H_