https_only_mode_ui_util.cc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2022 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. #include "components/security_interstitials/core/https_only_mode_ui_util.h"
  5. #include "components/security_interstitials/core/common_string_util.h"
  6. #include "components/strings/grit/components_strings.h"
  7. #include "ui/base/l10n/l10n_util.h"
  8. #include "url/gurl.h"
  9. void PopulateHttpsOnlyModeStringsForBlockingPage(
  10. base::Value::Dict& load_time_data,
  11. const GURL& url) {
  12. load_time_data.Set("tabTitle",
  13. l10n_util::GetStringUTF16(IDS_HTTPS_ONLY_MODE_TITLE));
  14. load_time_data.Set(
  15. "heading",
  16. l10n_util::GetStringFUTF16(
  17. IDS_HTTPS_ONLY_MODE_HEADING,
  18. security_interstitials::common_string_util::GetFormattedHostName(
  19. url)));
  20. load_time_data.Set(
  21. "primaryParagraph",
  22. l10n_util::GetStringUTF16(IDS_HTTPS_ONLY_MODE_PRIMARY_PARAGRAPH));
  23. // TODO(crbug.com/1302509): Change this button to "Close" when we can't go
  24. // back:
  25. load_time_data.Set(
  26. "proceedButtonText",
  27. l10n_util::GetStringUTF16(IDS_HTTPS_ONLY_MODE_SUBMIT_BUTTON));
  28. load_time_data.Set("primaryButtonText", l10n_util::GetStringUTF16(
  29. IDS_HTTPS_ONLY_MODE_BACK_BUTTON));
  30. load_time_data.Set("optInLink", l10n_util::GetStringUTF16(
  31. IDS_SAFE_BROWSING_SCOUT_REPORTING_AGREE));
  32. load_time_data.Set(
  33. "enhancedProtectionMessage",
  34. l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_ENHANCED_PROTECTION_MESSAGE));
  35. }
  36. void PopulateHttpsOnlyModeStringsForSharedHTML(
  37. base::Value::Dict& load_time_data) {
  38. load_time_data.Set("type", "HTTPS_ONLY");
  39. load_time_data.Set("overridable", false);
  40. load_time_data.Set("hide_primary_button", false);
  41. load_time_data.Set("show_recurrent_error_paragraph", false);
  42. load_time_data.Set("recurrentErrorParagraph", "");
  43. load_time_data.Set("openDetails", "");
  44. load_time_data.Set("explanationParagraph", "");
  45. load_time_data.Set("finalParagraph", "");
  46. }