Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: components/supervised_user_error_page/supervised_user_error_page.cc

Issue 2479413004: Supervised User interstitial: Update strings to be more child-friendly (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 19 matching lines...) Expand all
30 #endif 30 #endif
31 31
32 std::string BuildAvatarImageUrl(const std::string& url, int size) { 32 std::string BuildAvatarImageUrl(const std::string& url, int size) {
33 std::string result = url; 33 std::string result = url;
34 size_t slash = result.rfind('/'); 34 size_t slash = result.rfind('/');
35 if (slash != std::string::npos) 35 if (slash != std::string::npos)
36 result.insert(slash, "/s" + base::IntToString(size)); 36 result.insert(slash, "/s" + base::IntToString(size));
37 return result; 37 return result;
38 } 38 }
39 39
40 int GetBlockHeaderID(FilteringBehaviorReason reason) {
41 switch (reason) {
42 case DEFAULT:
43 return IDS_SUPERVISED_USER_BLOCK_HEADER_DEFAULT;
44 case BLACKLIST:
45 case ASYNC_CHECKER:
46 return IDS_SUPERVISED_USER_BLOCK_HEADER_SAFE_SITES;
47 case WHITELIST:
48 NOTREACHED();
49 break;
50 case MANUAL:
51 return IDS_SUPERVISED_USER_BLOCK_HEADER_MANUAL;
52 }
53 NOTREACHED();
54 return 0;
55 }
56 } // namespace 40 } // namespace
57 41
58 int GetBlockMessageID(FilteringBehaviorReason reason, 42 int GetBlockMessageID(FilteringBehaviorReason reason,
59 bool is_child_account, 43 bool is_child_account,
60 bool single_parent) { 44 bool single_parent) {
61 switch (reason) { 45 switch (reason) {
62 case DEFAULT: 46 case DEFAULT:
63 if (!is_child_account) 47 if (!is_child_account)
64 return IDS_SUPERVISED_USER_BLOCK_MESSAGE_DEFAULT; 48 return IDS_SUPERVISED_USER_BLOCK_MESSAGE_DEFAULT;
65 if (single_parent) 49 if (single_parent)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 strings.SetString("secondAvatarURL1x", 87 strings.SetString("secondAvatarURL1x",
104 BuildAvatarImageUrl(profile_image_url2, kAvatarSize1x)); 88 BuildAvatarImageUrl(profile_image_url2, kAvatarSize1x));
105 strings.SetString("secondAvatarURL2x", 89 strings.SetString("secondAvatarURL2x",
106 BuildAvatarImageUrl(profile_image_url2, kAvatarSize2x)); 90 BuildAvatarImageUrl(profile_image_url2, kAvatarSize2x));
107 base::string16 custodian16 = base::UTF8ToUTF16(custodian); 91 base::string16 custodian16 = base::UTF8ToUTF16(custodian);
108 strings.SetString("custodianName", custodian16); 92 strings.SetString("custodianName", custodian16);
109 strings.SetString("custodianEmail", base::UTF8ToUTF16(custodian_email)); 93 strings.SetString("custodianEmail", base::UTF8ToUTF16(custodian_email));
110 strings.SetString("secondCustodianName", base::UTF8ToUTF16(second_custodian)); 94 strings.SetString("secondCustodianName", base::UTF8ToUTF16(second_custodian));
111 strings.SetString("secondCustodianEmail", 95 strings.SetString("secondCustodianEmail",
112 base::UTF8ToUTF16(second_custodian_email)); 96 base::UTF8ToUTF16(second_custodian_email));
97 if (is_child_account) {
Marc Treib 2016/11/08 16:33:44 SUs don't get the header, which will effectively h
98 strings.SetString(
99 "blockPageHeader",
100 l10n_util::GetStringUTF16(IDS_CHILD_BLOCK_INTERSTITIAL_HEADER));
101 }
113 base::string16 block_message; 102 base::string16 block_message;
114 if (allow_access_requests) { 103 if (allow_access_requests) {
115 if (is_child_account) { 104 if (is_child_account) {
116 block_message = l10n_util::GetStringUTF16( 105 block_message =
117 second_custodian.empty() 106 l10n_util::GetStringUTF16(IDS_CHILD_BLOCK_INTERSTITIAL_MESSAGE);
Pam (message me for reviews) 2016/11/08 17:15:11 Hmm, two-parent management will be coming eventual
Marc Treib 2016/11/08 17:30:29 But the message doesn't reference the parent(s) an
118 ? IDS_CHILD_BLOCK_INTERSTITIAL_MESSAGE_SINGLE_PARENT
119 : IDS_CHILD_BLOCK_INTERSTITIAL_MESSAGE_MULTI_PARENT);
120 } else { 107 } else {
121 block_message = l10n_util::GetStringFUTF16(IDS_BLOCK_INTERSTITIAL_MESSAGE, 108 block_message = l10n_util::GetStringFUTF16(IDS_BLOCK_INTERSTITIAL_MESSAGE,
122 custodian16); 109 custodian16);
123 } 110 }
124 } else { 111 } else {
125 block_message = l10n_util::GetStringUTF16( 112 block_message = l10n_util::GetStringUTF16(
126 IDS_BLOCK_INTERSTITIAL_MESSAGE_ACCESS_REQUESTS_DISABLED); 113 IDS_BLOCK_INTERSTITIAL_MESSAGE_ACCESS_REQUESTS_DISABLED);
127 } 114 }
128 strings.SetString("blockPageMessage", block_message); 115 strings.SetString("blockPageMessage", block_message);
129 strings.SetString("blockReasonMessage", 116 strings.SetString("blockReasonMessage",
130 l10n_util::GetStringUTF16(GetBlockMessageID( 117 l10n_util::GetStringUTF16(GetBlockMessageID(
131 reason, is_child_account, second_custodian.empty()))); 118 reason, is_child_account, second_custodian.empty())));
132 strings.SetString("blockReasonHeader", 119 strings.SetString("blockReasonHeader", l10n_util::GetStringUTF16(
133 l10n_util::GetStringUTF16(GetBlockHeaderID(reason))); 120 IDS_SUPERVISED_USER_BLOCK_HEADER));
134 bool show_feedback = false; 121 bool show_feedback = false;
135 #if defined(GOOGLE_CHROME_BUILD) 122 #if defined(GOOGLE_CHROME_BUILD)
136 show_feedback = is_child_account && ReasonIsAutomatic(reason); 123 show_feedback = is_child_account && ReasonIsAutomatic(reason);
137 #endif 124 #endif
138 strings.SetBoolean("showFeedbackLink", show_feedback); 125 strings.SetBoolean("showFeedbackLink", show_feedback);
139 strings.SetString("feedbackLink", l10n_util::GetStringUTF16( 126 strings.SetString("feedbackLink", l10n_util::GetStringUTF16(
140 IDS_BLOCK_INTERSTITIAL_SEND_FEEDBACK)); 127 IDS_BLOCK_INTERSTITIAL_SEND_FEEDBACK));
141 strings.SetString("backButton", l10n_util::GetStringUTF16(IDS_BACK_BUTTON)); 128 strings.SetString("backButton", l10n_util::GetStringUTF16(IDS_BACK_BUTTON));
142 strings.SetString( 129 strings.SetString(
143 "requestAccessButton", 130 "requestAccessButton",
(...skipping 30 matching lines...) Expand all
174 std::string html = 161 std::string html =
175 ResourceBundle::GetSharedInstance() 162 ResourceBundle::GetSharedInstance()
176 .GetRawDataResource(IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML) 163 .GetRawDataResource(IDR_SUPERVISED_USER_BLOCK_INTERSTITIAL_HTML)
177 .as_string(); 164 .as_string();
178 webui::AppendWebUiCssTextDefaults(&html); 165 webui::AppendWebUiCssTextDefaults(&html);
179 std::string error_html = webui::GetI18nTemplateHtml(html, &strings); 166 std::string error_html = webui::GetI18nTemplateHtml(html, &strings);
180 return error_html; 167 return error_html;
181 } 168 }
182 169
183 } // namespace supervised_user_error_page 170 } // namespace supervised_user_error_page
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698