safe_browsing_quiet_error_ui.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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_QUIET_ERROR_UI_H_
  5. #define COMPONENTS_SECURITY_INTERSTITIALS_CORE_SAFE_BROWSING_QUIET_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. // Quiet version of the safe browsing interstitial. This is the small screen
  13. // version of the interstitial selectively used in parts of WebView.
  14. // This class displays a quiet UI for Safe Browsing errors that block page loads
  15. // specifically for WebView. This class is purely about visual display; it does
  16. // not do any error-handling logic to determine what type of error should be
  17. // displayed when.
  18. class SafeBrowsingQuietErrorUI
  19. : public security_interstitials::BaseSafeBrowsingErrorUI {
  20. public:
  21. SafeBrowsingQuietErrorUI(
  22. const GURL& request_url,
  23. const GURL& main_frame_url,
  24. BaseSafeBrowsingErrorUI::SBInterstitialReason reason,
  25. const BaseSafeBrowsingErrorUI::SBErrorDisplayOptions& display_options,
  26. const std::string& app_locale,
  27. const base::Time& time_triggered,
  28. ControllerClient* controller,
  29. const bool is_giant_webview);
  30. SafeBrowsingQuietErrorUI(const SafeBrowsingQuietErrorUI&) = delete;
  31. SafeBrowsingQuietErrorUI& operator=(const SafeBrowsingQuietErrorUI&) = delete;
  32. ~SafeBrowsingQuietErrorUI() override;
  33. // Fills the passed dictionary with the values to be passed to the template
  34. // when creating the HTML.
  35. void PopulateStringsForHtml(base::Value::Dict& load_time_data) override;
  36. void HandleCommand(SecurityInterstitialCommand command) override;
  37. // Manually set whether displaying in a giant WebView. Specifially used in
  38. // tests.
  39. void SetGiantWebViewForTesting(bool is_giant_webview);
  40. int GetHTMLTemplateId() const override;
  41. private:
  42. void PopulateMalwareLoadTimeData(base::Value::Dict& load_time_data);
  43. void PopulateHarmfulLoadTimeData(base::Value::Dict& load_time_data);
  44. void PopulatePhishingLoadTimeData(base::Value::Dict& load_time_data);
  45. void PopulateBillingLoadTimeData(base::Value::Dict& load_time_data);
  46. bool is_giant_webview_;
  47. };
  48. } // security_interstitials
  49. #endif // COMPONENTS_SECURITY_INTERSTITIALS_CORE_SAFE_BROWSING_QUIET_ERROR_UI_H_