Commit 42184989 authored by Mihai Sardarescu's avatar Mihai Sardarescu Committed by Commit Bot

Avoid passing unifiedConsentEnabled value to CrOS settings javascript code.

This CL avoids passing the unifiedConsentEnabled as a loadtime variable to
the ChromeOS settings javascript code.

A follow-up CL will also remove the "unified-consent-enabled" argument
from all JavaScript settings files.

Bug: 1015805
Change-Id: I66da81aa163950594b120ba6a5100de42234bf61
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1871989Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarThomas Tangl <tangltom@chromium.org>
Commit-Queue: Mihai Sardarescu <msarda@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709160}
parent 2a8b1e54
...@@ -147,25 +147,11 @@ ...@@ -147,25 +147,11 @@
</div> </div>
</template> </template>
<template is="dom-if" <cr-link-row id="sync-setup"
if="[[isPreUnifiedConsentAdvancedSyncSettingsVisible_( label="$i18n{syncAndNonPersonalizedServices}"
syncStatus, unifiedConsentEnabled_)]]"> sub-label="[[getSyncAndGoogleServicesSubtext_(syncStatus)]]"
<cr-link-row id="sync-status" on-click="onSyncTap_">
class$="[[getSyncStatusClass_(syncStatus)]]" </cr-link-row>
label="$i18n{syncAndNonPersonalizedServices}"
sub-label="[[getSyncAndGoogleServicesSubtext_(syncStatus)]]"
on-click="onSyncTap_" start-icon="[[getSyncIcon_(syncStatus)]]"
actionable$="[[isSyncStatusActionable_(syncStatus)]]">
</cr-link-row>
</template>
<template is="dom-if" if="[[unifiedConsentEnabled_]]">
<cr-link-row id="sync-setup"
label="$i18n{syncAndNonPersonalizedServices}"
sub-label="[[getSyncAndGoogleServicesSubtext_(syncStatus)]]"
on-click="onSyncTap_">
</cr-link-row>
</template>
<cr-link-row id="lock-screen-subpage-trigger" class="hr" <cr-link-row id="lock-screen-subpage-trigger" class="hr"
on-click="onConfigureLockTap_" on-click="onConfigureLockTap_"
...@@ -192,33 +178,27 @@ ...@@ -192,33 +178,27 @@
</template> </template>
</div> </div>
<template is="dom-if" route-path="/syncSetup"
no-search="[[!isAdvancedSyncSettingsSearchable_( <template is="dom-if" route-path="/syncSetup">
syncStatus, unifiedConsentEnabled_)]]">
<settings-subpage <settings-subpage
associated-control="[[getAdvancedSyncSettingsAssociatedControl_( associated-control="[[$$('#sync-setup')]"
unifiedConsentEnabled_)]]"
page-title="$i18n{syncPageTitle}" page-title="$i18n{syncPageTitle}"
learn-more-url="$i18n{syncAndGoogleServicesLearnMoreURL}" learn-more-url="$i18n{syncAndGoogleServicesLearnMoreURL}">
no-search$="[[!isAdvancedSyncSettingsSearchable_(syncStatus,
unifiedConsentEnabled_)]]">
<settings-sync-page <settings-sync-page
unified-consent-enabled="[[unifiedConsentEnabled_]]" unified-consent-enabled
sync-status="[[syncStatus]]" prefs="{{prefs}}" sync-status="[[syncStatus]]" prefs="{{prefs}}"
page-visibility="[[pageVisibility.privacy]]"> page-visibility="[[pageVisibility.privacy]]">
</settings-sync-page> </settings-sync-page>
</settings-subpage> </settings-subpage>
</template> </template>
<template is="dom-if" if="[[unifiedConsentEnabled_]]"> <template is="dom-if" route-path="/syncSetup/advanced">
<template is="dom-if" route-path="/syncSetup/advanced"> <settings-subpage page-title="$i18n{syncAdvancedPageTitle}"
<settings-subpage page-title="$i18n{syncAdvancedPageTitle}" associated-control="[[$$('#sync-setup')]]"
associated-control="[[$$('#sync-setup')]]" learn-more-url="$i18n{syncAndGoogleServicesLearnMoreURL}">
learn-more-url="$i18n{syncAndGoogleServicesLearnMoreURL}"> <settings-sync-controls sync-status="[[syncStatus]]">
<settings-sync-controls sync-status="[[syncStatus]]"> </settings-sync-controls>
</settings-sync-controls> </settings-subpage>
</settings-subpage>
</template>
</template> </template>
<template is="dom-if" route-path="/lockScreen"> <template is="dom-if" route-path="/lockScreen">
......
...@@ -26,20 +26,6 @@ Polymer({ ...@@ -26,20 +26,6 @@ Polymer({
notify: true, notify: true,
}, },
/**
* This flag is used to conditionally show a set of sync UIs to the
* profiles that have been migrated to have a unified consent flow.
* TODO(tangltom): In the future when all profiles are completely migrated,
* this should be removed, and UIs hidden behind it should become default.
* @private
*/
unifiedConsentEnabled_: {
type: Boolean,
value: function() {
return loadTimeData.getBoolean('unifiedConsentEnabled');
},
},
/** /**
* The current sync status, supplied by SyncBrowserProxy. * The current sync status, supplied by SyncBrowserProxy.
* @type {?settings.SyncStatus} * @type {?settings.SyncStatus}
...@@ -118,11 +104,7 @@ Polymer({ ...@@ -118,11 +104,7 @@ Polymer({
value: function() { value: function() {
const map = new Map(); const map = new Map();
if (settings.routes.SYNC) { if (settings.routes.SYNC) {
map.set( map.set(settings.routes.SYNC.path, '#sync-setup');
settings.routes.SYNC.path,
loadTimeData.getBoolean('unifiedConsentEnabled') ?
'#sync-setup' :
'#sync-status');
} }
if (settings.routes.LOCK_SCREEN) { if (settings.routes.LOCK_SCREEN) {
map.set( map.set(
...@@ -293,38 +275,8 @@ Polymer({ ...@@ -293,38 +275,8 @@ Polymer({
/** @private */ /** @private */
onSyncTap_: function() { onSyncTap_: function() {
// When unified-consent is enabled, users can go to sync subpage regardless // Users can go to sync subpage regardless of sync status.
// of sync status. settings.navigateTo(settings.routes.SYNC);
if (this.unifiedConsentEnabled_) {
settings.navigateTo(settings.routes.SYNC);
return;
}
// TODO(crbug.com/862983): Remove this code once UnifiedConsent is rolled
// out to 100%.
assert(this.syncStatus.signedIn);
assert(this.syncStatus.syncSystemEnabled);
if (!this.isSyncStatusActionable_(this.syncStatus)) {
return;
}
switch (this.syncStatus.statusAction) {
case settings.StatusAction.REAUTHENTICATE:
this.syncBrowserProxy_.startSignIn();
break;
case settings.StatusAction.SIGNOUT_AND_SIGNIN:
this.syncBrowserProxy_.attemptUserExit();
break;
case settings.StatusAction.UPGRADE_CLIENT:
settings.navigateTo(settings.routes.ABOUT);
break;
case settings.StatusAction.ENTER_PASSPHRASE:
case settings.StatusAction.CONFIRM_SYNC_SETTINGS:
case settings.StatusAction.NO_ACTION:
default:
settings.navigateTo(settings.routes.SYNC);
}
}, },
/** /**
...@@ -362,90 +314,6 @@ Polymer({ ...@@ -362,90 +314,6 @@ Polymer({
settings.navigateTo(settings.routes.ACCOUNTS); settings.navigateTo(settings.routes.ACCOUNTS);
}, },
/**
* @private
* @param {?settings.SyncStatus} syncStatus
* @return {boolean}
*/
isPreUnifiedConsentAdvancedSyncSettingsVisible_: function(syncStatus) {
return !!syncStatus && !!syncStatus.signedIn &&
!!syncStatus.syncSystemEnabled && !this.unifiedConsentEnabled_;
},
/**
* @private
* @param {?settings.SyncStatus} syncStatus
* @return {boolean}
*/
isAdvancedSyncSettingsSearchable_: function(syncStatus) {
return this.isPreUnifiedConsentAdvancedSyncSettingsVisible_(syncStatus) ||
!!this.unifiedConsentEnabled_;
},
/**
* @private
* @return {Element|null}
*/
getAdvancedSyncSettingsAssociatedControl_: function() {
return this.unifiedConsentEnabled_ ? this.$$('#sync-setup') :
this.$$('#sync-status');
},
/**
* @private
* @param {?settings.SyncStatus} syncStatus
* @return {boolean} Whether an action can be taken with the sync status. sync
* status is actionable if sync is not managed and if there is a sync
* error, there is an action associated with it.
*/
isSyncStatusActionable_: function(syncStatus) {
return !!syncStatus && !syncStatus.managed &&
(!syncStatus.hasError ||
syncStatus.statusAction != settings.StatusAction.NO_ACTION);
},
/**
* @private
* @param {?settings.SyncStatus} syncStatus
* @return {string}
*/
getSyncIcon_: function(syncStatus) {
if (!syncStatus) {
return '';
}
let syncIcon = 'cr:sync';
if (syncStatus.hasError) {
syncIcon = 'settings:sync-problem';
}
// Override the icon to the disabled icon if sync is managed.
if (syncStatus.managed ||
syncStatus.statusAction == settings.StatusAction.REAUTHENTICATE) {
syncIcon = 'settings:sync-disabled';
}
return syncIcon;
},
/**
* @private
* @param {?settings.SyncStatus} syncStatus
* @return {string} The class name for the sync status row.
*/
getSyncStatusClass_: function(syncStatus) {
if (syncStatus && syncStatus.hasError) {
// Most of the time re-authenticate states are caused by intentional user
// action, so they will be displayed differently as other errors.
return syncStatus.statusAction == settings.StatusAction.REAUTHENTICATE ?
'auth-error' :
'sync-error';
}
return 'no-error';
},
/** /**
* @param {string} iconUrl * @param {string} iconUrl
* @return {string} A CSS image-set for multiple scale factors. * @return {string} A CSS image-set for multiple scale factors.
......
...@@ -102,9 +102,6 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui) ...@@ -102,9 +102,6 @@ OSSettingsUI::OSSettingsUI(content::WebUI* web_ui)
AddSettingsPageUIHandler( AddSettingsPageUIHandler(
std::make_unique<chromeos::settings::WallpaperHandler>(web_ui)); std::make_unique<chromeos::settings::WallpaperHandler>(web_ui));
// TODO(msarda): Remove |unifiedConsentEnabled| from all settings resources.
html_source->AddBoolean("unifiedConsentEnabled", true);
html_source->AddBoolean("showAppManagement", base::FeatureList::IsEnabled( html_source->AddBoolean("showAppManagement", base::FeatureList::IsEnabled(
features::kAppManagement)); features::kAppManagement));
......
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