Commit b497c93b authored by Bernhard Bauer's avatar Bernhard Bauer Committed by Commit Bot

Show details section in supervised user interstitial only if feedback is enabled.

In all other cases, the details section does not contain actionable information.

Also, update the block message per UI review.

Bug: 736043
Change-Id: Ib6cae1ac04f4af97398ea0bf6c5f16676d79f382
Reviewed-on: https://chromium-review.googlesource.com/566959Reviewed-by: 's avatarMarc Treib <treib@chromium.org>
Commit-Queue: Bernhard Bauer <bauerb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485667}
parent b6e6f8cb
......@@ -495,8 +495,8 @@ std::string InterstitialHTMLSource::GetSupervisedUserInterstitialHTML(
supervised_user_error_page::DEFAULT;
std::string reason_string;
if (net::GetValueForKeyInQuery(url, "reason", &reason_string)) {
if (reason_string == "safe_sites") {
reason = supervised_user_error_page::BLACKLIST;
if (reason_string == "safe_sites" && is_child_account) {
reason = supervised_user_error_page::ASYNC_CHECKER;
} else if (reason_string == "manual") {
reason = supervised_user_error_page::MANUAL;
} else if (reason_string == "not_signed_in") {
......
......@@ -42,16 +42,16 @@
$i18n{requestAccessButton}
</button>
<div id="details-button-container">
<button id="show-details-link" class="details-button small-link" hidden>
<button id="show-details-link" class="details-button small-link">
$i18n{showDetailsLink}
</button>
<button id="hide-details-link" class="details-button small-link" hidden>
$i18n{hideDetailsLink}
</button>
<button id="back-button" class="details-button small-link" hidden>
$i18n{backButton}
</button>
</div>
<button id="back-button" class="details-button small-link" hidden>
$i18n{backButton}
</button>
</div>
<div id="details" hidden>
<p id="details-header">$i18n{blockReasonHeader}</p>
......
......@@ -37,6 +37,9 @@ function setupMobileNav() {
document.addEventListener('DOMContentLoaded', setupMobileNav);
function sendCommand(cmd) {
// TODO(bauerb): domAutomationController is not defined when this page is
// shown in chrome://interstitials. Use a MessageHandler or something to
// support interactions.
window.domAutomationController.setAutomationId(1);
window.domAutomationController.send(cmd);
}
......@@ -50,11 +53,7 @@ function initialize() {
if (allowAccessRequests) {
$('request-access-button').onclick = function(event) {
$('request-access-button').hidden = true;
if (window.domAutomationController) {
sendCommand('request');
} else {
window.webRestrictions.requestPermission(setRequestStatus);
}
sendCommand('request');
};
} else {
$('request-access-button').hidden = true;
......@@ -85,31 +84,28 @@ function initialize() {
'secondCustodianEmail');
}
}
var showDetailsLink = loadTimeData.getString('showDetailsLink');
$('show-details-link').hidden = !showDetailsLink;
$('back-button').hidden = showDetailsLink || !window.domAutomationController;
$('back-button').onclick = function(event) {
sendCommand('back');
};
$('show-details-link').onclick = function(event) {
showDetails = true;
$('show-details-link').hidden = true;
$('hide-details-link').hidden = false;
updateDetails();
};
$('hide-details-link').onclick = function(event) {
showDetails = false;
$('show-details-link').hidden = false;
$('hide-details-link').hidden = true;
updateDetails();
};
if (window.domAutomationController &&
loadTimeData.getBoolean('showFeedbackLink')) {
if (loadTimeData.getBoolean('showFeedbackLink')) {
$('show-details-link').onclick = function(event) {
showDetails = true;
$('show-details-link').hidden = true;
$('hide-details-link').hidden = false;
updateDetails();
};
$('hide-details-link').onclick = function(event) {
showDetails = false;
$('show-details-link').hidden = false;
$('hide-details-link').hidden = true;
updateDetails();
};
$('feedback-link').onclick = function(event) {
sendCommand('feedback');
};
} else {
$('feedback').hidden = true;
$('details-button-container').hidden = true;
}
}
......@@ -128,7 +124,7 @@ function setRequestStatus(isSuccessful) {
if (isSuccessful) {
$('request-failed-message').hidden = true;
$('request-sent-message').hidden = false;
$('back-button').hidden = !window.domAutomationController;
$('back-button').hidden = false;
$('request-access-button').hidden = true;
$('show-details-link').hidden = true;
} else {
......
......@@ -11,13 +11,13 @@
Ask your parent
</message>
<message name="IDS_BLOCK_INTERSTITIAL_HEADER_ACCESS_REQUESTS_DISABLED" desc="A heading for the supervised user when they attempt to visit a site that is not permitted by the manager (and they can't ask for permission).">
Looks like you don't have permission to visit this site
You don't have permission to visit this site
</message>
<message name="IDS_BLOCK_INTERSTITIAL_HEADER_NOT_SIGNED_IN" desc="A heading for the supervised user when the status cannot be established because they haven't signed in to Chrome).">
Please start and sign in to Chrome before using this app.
</message>
<message name="IDS_CHILD_BLOCK_INTERSTITIAL_MESSAGE" desc="A message for the child user when they attempt to visit a site that is not permitted by their parent.">
Looks like you need permission to visit this site
You need permission to visit this site
</message>
<message name="IDS_BLOCK_INTERSTITIAL_MESSAGE_SUPERVISED_USERS_DEPRECATED" desc="Message to be shown to a supervised user directing them to the supervisor.">
Questions? Contact the person who supervises your profile.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment