OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/supervised_user_error_page/supervised_user_error_page.h" | 5 #include "components/supervised_user_error_page/supervised_user_error_page.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 return IDS_SUPERVISED_USER_BLOCK_MESSAGE_SAFE_SITES; | 54 return IDS_SUPERVISED_USER_BLOCK_MESSAGE_SAFE_SITES; |
55 case WHITELIST: | 55 case WHITELIST: |
56 NOTREACHED(); | 56 NOTREACHED(); |
57 break; | 57 break; |
58 case MANUAL: | 58 case MANUAL: |
59 if (!is_child_account) | 59 if (!is_child_account) |
60 return IDS_SUPERVISED_USER_BLOCK_MESSAGE_MANUAL; | 60 return IDS_SUPERVISED_USER_BLOCK_MESSAGE_MANUAL; |
61 if (single_parent) | 61 if (single_parent) |
62 return IDS_CHILD_BLOCK_MESSAGE_MANUAL_SINGLE_PARENT; | 62 return IDS_CHILD_BLOCK_MESSAGE_MANUAL_SINGLE_PARENT; |
63 return IDS_CHILD_BLOCK_MESSAGE_MANUAL_MULTI_PARENT; | 63 return IDS_CHILD_BLOCK_MESSAGE_MANUAL_MULTI_PARENT; |
| 64 case NOT_SIGNED_IN: |
| 65 return IDS_SUPERVISED_USER_NOT_SIGNED_IN; |
64 } | 66 } |
65 NOTREACHED(); | 67 NOTREACHED(); |
66 return 0; | 68 return 0; |
67 } | 69 } |
68 | 70 |
69 std::string BuildHtml(bool allow_access_requests, | 71 std::string BuildHtml(bool allow_access_requests, |
70 const std::string& profile_image_url, | 72 const std::string& profile_image_url, |
71 const std::string& profile_image_url2, | 73 const std::string& profile_image_url2, |
72 const std::string& custodian, | 74 const std::string& custodian, |
73 const std::string& custodian_email, | 75 const std::string& custodian_email, |
(...skipping 15 matching lines...) Expand all Loading... |
89 strings.SetString("secondAvatarURL2x", | 91 strings.SetString("secondAvatarURL2x", |
90 BuildAvatarImageUrl(profile_image_url2, kAvatarSize2x)); | 92 BuildAvatarImageUrl(profile_image_url2, kAvatarSize2x)); |
91 base::string16 custodian16 = base::UTF8ToUTF16(custodian); | 93 base::string16 custodian16 = base::UTF8ToUTF16(custodian); |
92 strings.SetString("custodianName", custodian16); | 94 strings.SetString("custodianName", custodian16); |
93 strings.SetString("custodianEmail", base::UTF8ToUTF16(custodian_email)); | 95 strings.SetString("custodianEmail", base::UTF8ToUTF16(custodian_email)); |
94 strings.SetString("secondCustodianName", base::UTF8ToUTF16(second_custodian)); | 96 strings.SetString("secondCustodianName", base::UTF8ToUTF16(second_custodian)); |
95 strings.SetString("secondCustodianEmail", | 97 strings.SetString("secondCustodianEmail", |
96 base::UTF8ToUTF16(second_custodian_email)); | 98 base::UTF8ToUTF16(second_custodian_email)); |
97 base::string16 block_header; | 99 base::string16 block_header; |
98 base::string16 block_message; | 100 base::string16 block_message; |
99 if (allow_access_requests) { | 101 if (reason == FilteringBehaviorReason::NOT_SIGNED_IN) { |
| 102 block_header = |
| 103 l10n_util::GetStringUTF16(IDS_BLOCK_INTERSTITIAL_HEADER_NOT_SIGNED_IN); |
| 104 } else if (allow_access_requests) { |
100 if (is_child_account) { | 105 if (is_child_account) { |
101 block_header = | 106 block_header = |
102 l10n_util::GetStringUTF16(IDS_CHILD_BLOCK_INTERSTITIAL_HEADER); | 107 l10n_util::GetStringUTF16(IDS_CHILD_BLOCK_INTERSTITIAL_HEADER); |
103 block_message = | 108 block_message = |
104 l10n_util::GetStringUTF16(IDS_CHILD_BLOCK_INTERSTITIAL_MESSAGE); | 109 l10n_util::GetStringUTF16(IDS_CHILD_BLOCK_INTERSTITIAL_MESSAGE); |
105 } else { | 110 } else { |
106 block_header = l10n_util::GetStringFUTF16(IDS_BLOCK_INTERSTITIAL_HEADER, | 111 block_header = l10n_util::GetStringFUTF16(IDS_BLOCK_INTERSTITIAL_HEADER, |
107 custodian16); | 112 custodian16); |
108 // For non-child accounts, the block message is empty. | 113 // For non-child accounts, the block message is empty. |
109 } | 114 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 std::string html = | 167 std::string html = |
163 ResourceBundle::GetSharedInstance() | 168 ResourceBundle::GetSharedInstance() |
164 .GetRawDataResource(IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML) | 169 .GetRawDataResource(IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML) |
165 .as_string(); | 170 .as_string(); |
166 webui::AppendWebUiCssTextDefaults(&html); | 171 webui::AppendWebUiCssTextDefaults(&html); |
167 std::string error_html = webui::GetI18nTemplateHtml(html, &strings); | 172 std::string error_html = webui::GetI18nTemplateHtml(html, &strings); |
168 return error_html; | 173 return error_html; |
169 } | 174 } |
170 | 175 |
171 } // namespace supervised_user_error_page | 176 } // namespace supervised_user_error_page |
OLD | NEW |