Commit 2d1da95c authored by kelvinp's avatar kelvinp Committed by Commit bot

Fix unable to opt-in to crash reports & usage statistics from web-app

Cause:
The crash opt-in setting is sometimes controlled by domain policy, which will
prevent the user from enabling it.  However, this is not communicated to the
user properly.

Fix:
- Shows a tooltip "This setting is controlled by your domain policy" if
  necessary.
- Hides the check box if the domain doesn't allow usage stats collection
  as an empty disabled check box offers no value to the user.

BUG=388864

Review URL: https://codereview.chromium.org/898163002

Cr-Commit-Position: refs/heads/master@{#315105}
parent 56a3dba9
......@@ -1050,6 +1050,9 @@ For information about privacy, please see the Google Privacy Policy (http://goo.
<message desc="Label for the button to decline sharing the computer in 'It2Me' mode." name="IDS_SHARE_CONFIRM_DIALOG_DECLINE" >
Cancel
</message>
<message desc="Text shown in tooltip to inform the user that a setting is managed by domain policy." name="IDS_SETTING_MANAGED_BY_POLICY">
This setting is managed by your domain policy.
</message>
</messages>
</release>
......
......@@ -190,9 +190,21 @@ remoting.HostSetupDialog.prototype.showForStartWithToken_ =
* by policy.
*/
function onGetConsent(supported, allowed, set_by_policy) {
that.usageStats_.hidden = !supported;
// Hide the usage stats check box if it is not supported or the policy
// doesn't allow usage stats collection.
var checkBoxLabel = that.usageStats_.querySelector('.checkbox-label');
that.usageStats_.hidden = !supported || (set_by_policy && !allowed);
that.usageStatsCheckbox_.checked = allowed;
that.usageStatsCheckbox_.disabled = set_by_policy;
checkBoxLabel.classList.toggle('disabled', set_by_policy);
if (set_by_policy) {
that.usageStats_.title = l10n.getTranslationOrError(
/*i18n-content*/ 'SETTING_MANAGED_BY_POLICY');
} else {
that.usageStats_.title = '';
}
}
/** @param {remoting.Error} error */
......@@ -200,7 +212,7 @@ remoting.HostSetupDialog.prototype.showForStartWithToken_ =
console.error('Error getting consent status: ' + error);
}
this.usageStats_.hidden = false;
this.usageStats_.hidden = true;
this.usageStatsCheckbox_.checked = false;
// Prevent user from ticking the box until the current consent status is
......
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