| Index: components/supervised_user_error_page/supervised_user_error_page.cc
|
| diff --git a/components/supervised_user_error_page/supervised_user_error_page.cc b/components/supervised_user_error_page/supervised_user_error_page.cc
|
| index ffb0fa8dca3cfc57ead30662d121fd634b73f1de..714566be41164b142cca9135799c0cc065db857d 100644
|
| --- a/components/supervised_user_error_page/supervised_user_error_page.cc
|
| +++ b/components/supervised_user_error_page/supervised_user_error_page.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/macros.h"
|
| #include "base/strings/string_number_conversions.h"
|
| +#include "base/strings/utf_string_conversions.h"
|
| #include "base/values.h"
|
| #include "grit/components_resources.h"
|
| #include "grit/components_strings.h"
|
| @@ -80,13 +81,29 @@ int GetBlockMessageID(FilteringBehaviorReason reason,
|
| return 0;
|
| }
|
|
|
| +std::string BuildHtmlFromWebRestrictionsResult(
|
| + const web_restrictions::mojom::ClientResultPtr& result,
|
| + const std::string app_locale) {
|
| + return BuildHtml(
|
| + result->intParams["Allow access requests"],
|
| + result->stringParams["Profile image URL"],
|
| + result->stringParams["Second profile image URL"],
|
| + result->stringParams["Custodian"],
|
| + result->stringParams["Custodian email"],
|
| + result->stringParams["Second custodian"],
|
| + result->stringParams["Second custodian email"],
|
| + result->intParams["Is child account"],
|
| + static_cast<FilteringBehaviorReason>(result->intParams["Reason"]),
|
| + app_locale);
|
| +}
|
| +
|
| std::string BuildHtml(bool allow_access_requests,
|
| const std::string& profile_image_url,
|
| const std::string& profile_image_url2,
|
| - const base::string16& custodian,
|
| - const base::string16& custodian_email,
|
| - const base::string16& second_custodian,
|
| - const base::string16& second_custodian_email,
|
| + const std::string& custodian,
|
| + const std::string& custodian_email,
|
| + const std::string& second_custodian,
|
| + const std::string& second_custodian_email,
|
| bool is_child_account,
|
| FilteringBehaviorReason reason,
|
| const std::string& app_locale) {
|
| @@ -102,10 +119,12 @@ std::string BuildHtml(bool allow_access_requests,
|
| BuildAvatarImageUrl(profile_image_url2, kAvatarSize1x));
|
| strings.SetString("secondAvatarURL2x",
|
| BuildAvatarImageUrl(profile_image_url2, kAvatarSize2x));
|
| - strings.SetString("custodianName", custodian);
|
| - strings.SetString("custodianEmail", custodian_email);
|
| - strings.SetString("secondCustodianName", second_custodian);
|
| - strings.SetString("secondCustodianEmail", second_custodian_email);
|
| + base::string16 custodian16 = base::UTF8ToUTF16(custodian);
|
| + strings.SetString("custodianName", custodian16);
|
| + strings.SetString("custodianEmail", base::UTF8ToUTF16(custodian_email));
|
| + strings.SetString("secondCustodianName", base::UTF8ToUTF16(second_custodian));
|
| + strings.SetString("secondCustodianEmail",
|
| + base::UTF8ToUTF16(second_custodian_email));
|
| base::string16 block_message;
|
| if (allow_access_requests) {
|
| if (is_child_account) {
|
| @@ -114,8 +133,8 @@ std::string BuildHtml(bool allow_access_requests,
|
| ? IDS_CHILD_BLOCK_INTERSTITIAL_MESSAGE_SINGLE_PARENT
|
| : IDS_CHILD_BLOCK_INTERSTITIAL_MESSAGE_MULTI_PARENT);
|
| } else {
|
| - block_message =
|
| - l10n_util::GetStringFUTF16(IDS_BLOCK_INTERSTITIAL_MESSAGE, custodian);
|
| + block_message = l10n_util::GetStringFUTF16(IDS_BLOCK_INTERSTITIAL_MESSAGE,
|
| + custodian16);
|
| }
|
| } else {
|
| block_message = l10n_util::GetStringUTF16(
|
| @@ -160,9 +179,9 @@ std::string BuildHtml(bool allow_access_requests,
|
| }
|
| } else {
|
| request_sent_message = l10n_util::GetStringFUTF16(
|
| - IDS_BLOCK_INTERSTITIAL_REQUEST_SENT_MESSAGE, custodian);
|
| + IDS_BLOCK_INTERSTITIAL_REQUEST_SENT_MESSAGE, custodian16);
|
| request_failed_message = l10n_util::GetStringFUTF16(
|
| - IDS_BLOCK_INTERSTITIAL_REQUEST_FAILED_MESSAGE, custodian);
|
| + IDS_BLOCK_INTERSTITIAL_REQUEST_FAILED_MESSAGE, custodian16);
|
| }
|
| strings.SetString("requestSentMessage", request_sent_message);
|
| strings.SetString("requestFailedMessage", request_failed_message);
|
| @@ -172,7 +191,8 @@ std::string BuildHtml(bool allow_access_requests,
|
| .GetRawDataResource(IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML)
|
| .as_string();
|
| webui::AppendWebUiCssTextDefaults(&html);
|
| - return webui::GetI18nTemplateHtml(html, &strings);
|
| + std::string error_html = webui::GetI18nTemplateHtml(html, &strings);
|
| + return error_html;
|
| }
|
|
|
| } // namespace supervised_user_error_page
|
|
|