diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 17:21:03 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 16:25:15 +0000 |
commit | c551f43206405019121bd2b2c93714319a0a3300 (patch) | |
tree | 1f48c30631c421fd4bbb3c36da20183c8a2ed7d7 /chromium/chrome/browser/resources/settings/people_page | |
parent | 7961cea6d1041e3e454dae6a1da660b453efd238 (diff) |
BASELINE: Update Chromium to 79.0.3945.139
Change-Id: I336b7182fab9bca80b709682489c07db112eaca5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/chrome/browser/resources/settings/people_page')
8 files changed, 127 insertions, 22 deletions
diff --git a/chromium/chrome/browser/resources/settings/people_page/account_manager.html b/chromium/chrome/browser/resources/settings/people_page/account_manager.html index 3addbf6027c..f5d9d8bc29f 100644 --- a/chromium/chrome/browser/resources/settings/people_page/account_manager.html +++ b/chromium/chrome/browser/resources/settings/people_page/account_manager.html @@ -4,6 +4,7 @@ <link rel="import" href="chrome://resources/cr_elements/cr_button/cr_button.html"> <link rel="import" href="chrome://resources/cr_elements/cr_icon_button/cr_icon_button.html"> <link rel="import" href="chrome://resources/cr_elements/policy/cr_policy_indicator.html"> +<link rel="import" href="chrome://resources/cr_elements/policy/cr_tooltip_icon.html"> <link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/icon.html"> <link rel="import" href="chrome://resources/html/util.html"> @@ -44,8 +45,17 @@ margin-inline-start: 60px; } - #account-list-header { - padding-bottom: 8px; + .secondary-accounts-policy-indicator { + margin-inline-end: 12px; + } + + .settings-box.user-message { + align-items: flex-end; + } + + #account-list-header > h2 { + padding-bottom: 12px; + padding-top: 12px; } cr-policy-indicator { @@ -54,7 +64,8 @@ } #add-account-button { - margin-top: var(--add-account-margin-top); + margin-bottom: 12px; + margin-top: 12px; } #add-account-icon { @@ -88,6 +99,11 @@ .management-status { color: var(--cr-secondary-text-color); } + + .tooltip-primary-account { + margin-inline-end: 12px; + margin-inline-start: 12px; + } </style> <div class="settings-box first"> @@ -99,14 +115,21 @@ </span> </div> + <div id="settings-box-user-message" class="settings-box first user-message" + hidden="[[isSecondaryGoogleAccountSigninAllowed_()]]"> + <cr-policy-pref-indicator class="secondary-accounts-policy-indicator" + pref= + "[[prefs.account_manager.secondary_google_account_signin_allowed]]"> + </cr-policy-pref-indicator> + <div id="user-message-text" class="secondary"> + [[getSecondaryAccountsDisabledUserMessage_()]] + </div> + </div> + <div class="settings-box first"> <div id="account-list-header" class="flex"> <h2>$i18n{accountListHeader}</h2> </div> - <cr-policy-indicator - hidden="[[isSecondaryGoogleAccountSigninAllowed_()]]" - indicator-type="userPolicy"> - </cr-policy-indicator> <cr-button disabled="[[!isSecondaryGoogleAccountSigninAllowed_()]]" id="add-account-button" on-tap="addAccount_"> <div id="add-account-icon"></div> @@ -152,6 +175,11 @@ <!-- If this is the Device Account, display the management status --> <template is="dom-if" if="[[item.isDeviceAccount]]"> + <cr-tooltip-icon icon-class="cr:info-outline" + class="tooltip-primary-account" + tooltip-text="$i18n{accountManagerPrimaryAccountTooltip}" + icon-aria-label="$i18n{accountManagerPrimaryAccountTooltip}"> + </cr-tooltip-icon> <span class="management-status"> [[getManagementLabel_(item)]] </span> diff --git a/chromium/chrome/browser/resources/settings/people_page/account_manager.js b/chromium/chrome/browser/resources/settings/people_page/account_manager.js index 8613c1262a3..e5cecdcd17f 100644 --- a/chromium/chrome/browser/resources/settings/people_page/account_manager.js +++ b/chromium/chrome/browser/resources/settings/people_page/account_manager.js @@ -70,6 +70,17 @@ Polymer({ }, /** + * @return {string} 'Secondary Accounts disabled' message depending on + * account type + * @private + */ + getSecondaryAccountsDisabledUserMessage_: function() { + return loadTimeData.getBoolean('isChild') + ? this.i18n('accountManagerSecondaryAccountsDisabledChildText') + : this.i18n('accountManagerSecondaryAccountsDisabledText'); + }, + + /** * @param {string} iconUrl * @return {string} A CSS image-set for multiple scale factors. * @private diff --git a/chromium/chrome/browser/resources/settings/people_page/setup_pin_dialog.html b/chromium/chrome/browser/resources/settings/people_page/setup_pin_dialog.html index ec1fb7827e3..093bace2c14 100644 --- a/chromium/chrome/browser/resources/settings/people_page/setup_pin_dialog.html +++ b/chromium/chrome/browser/resources/settings/people_page/setup_pin_dialog.html @@ -13,6 +13,10 @@ <style include="settings-shared"> #pinKeyboardDiv { justify-content: center; + }; + + #pinKeyboard { + --cr-input-placeholder-letter-spacing: normal; } </style> <cr-dialog id="dialog" on-close="close" @@ -28,7 +32,8 @@ on-set-pin-done="onSetPinDone_" set-modes="{{setModes}}" quick-unlock-private="[[quickUnlockPrivate]]" - write-uma="[[writeUma_]]"> + write-uma="[[writeUma_]]" + enable-placeholder> </setup-pin-keyboard> </div> </div> diff --git a/chromium/chrome/browser/resources/settings/people_page/sync_page.js b/chromium/chrome/browser/resources/settings/people_page/sync_page.js index fd28dad676a..e65b7efd44b 100644 --- a/chromium/chrome/browser/resources/settings/people_page/sync_page.js +++ b/chromium/chrome/browser/resources/settings/people_page/sync_page.js @@ -506,7 +506,10 @@ Polymer({ case settings.PageStatus.PASSPHRASE_FAILED: if (this.pageStatus_ == this.pages_.CONFIGURE && this.syncPrefs && this.syncPrefs.passphraseRequired) { - this.$$('#existingPassphraseInput').invalid = true; + const passphraseInput = /** @type {!CrInputElement} */ ( + this.$$('#existingPassphraseInput')); + passphraseInput.invalid = true; + passphraseInput.focusInput(); } return; } diff --git a/chromium/chrome/browser/resources/settings/people_page/user_list.html b/chromium/chrome/browser/resources/settings/people_page/user_list.html index f6ba5eba5bd..dbc871abac2 100644 --- a/chromium/chrome/browser/resources/settings/people_page/user_list.html +++ b/chromium/chrome/browser/resources/settings/people_page/user_list.html @@ -47,8 +47,10 @@ <div class="user layout horizontal center two-line"> <img class="user-icon" src="[[getProfilePictureUrl_(item)]]"> <div class="flex layout vertical user-info no-min-width"> - <div class="text-elide">[[getUserName_(item)]]</div> - <div class="secondary text-elide" + <div class="text-elide" title="[[getTooltip_(item)]]"> + [[getUserName_(item)]] + </div> + <div class="secondary text-elide" title="[[item.displayEmail]]" hidden$="[[!shouldShowEmail_(item)]]"> [[item.displayEmail]] </div> diff --git a/chromium/chrome/browser/resources/settings/people_page/user_list.js b/chromium/chrome/browser/resources/settings/people_page/user_list.js index 66786887296..066f71f607c 100644 --- a/chromium/chrome/browser/resources/settings/people_page/user_list.js +++ b/chromium/chrome/browser/resources/settings/people_page/user_list.js @@ -123,4 +123,14 @@ Polymer({ shouldShowEmail_: function(user) { return !user.isSupervised && user.name != user.displayEmail; }, + + /** + * Use this function to prevent tooltips from displaying for user names. We + * only want to display tooltips for email addresses. + * @param {chrome.usersPrivate.User} user + * @private + */ + getTooltip_: function(user) { + return !this.shouldShowEmail_(user) ? user.displayEmail : ''; + }, }); diff --git a/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.html b/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.html index e1caa97fc46..cbcbc0b24d5 100644 --- a/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.html +++ b/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.html @@ -10,17 +10,17 @@ <dom-module id="settings-users-add-user-dialog"> <template> <style include="settings-shared"> - cr-input { - width: var(--settings-input-max-width); - --cr-input-error-display: none; + cr-dialog::part(dialog) { + width: 320px; } </style> <cr-dialog id="dialog" close-text="$i18n{close}"> <div slot="title">$i18n{addUsers}</div> <div slot="body"> <cr-input id="addUserInput" label="$i18n{addUsersEmail}" - invalid="[[shouldShowError_(isEmail_, isEmpty_)]]" - on-value-changed="onInput_" autofocus> + invalid="[[shouldShowError_(errorCode_)]]" + on-value-changed="onInput_" + error-message="[[getErrorString_(errorCode_)]]" autofocus> </cr-input> </div> <div slot="button-container"> diff --git a/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.js b/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.js index 3721024821d..a68a908b4b6 100644 --- a/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.js +++ b/chromium/chrome/browser/resources/settings/people_page/users_add_user_dialog.js @@ -29,11 +29,26 @@ const EMAIL_REGEX = new RegExp( '^\\s*([\\w\\.!#\\$%&\'\\*\\+-\\/=\\?\\^`\\{\\|\\}~]+)@' + '([A-Za-z0-9\-]{2,63}\\..+)\\s*$'); +/** @enum {number} */ +const UserAddError = { + NO_ERROR: 0, + INVALID_EMAIL: 1, + USER_EXISTS: 2, +}; + Polymer({ is: 'settings-users-add-user-dialog', + behaviors: [I18nBehavior], + properties: { /** @private */ + errorCode_: { + type: Number, + value: UserAddError.NO_ERROR, + }, + + /** @private */ isEmail_: { type: Boolean, value: false, @@ -46,6 +61,8 @@ Polymer({ }, }, + usersPrivate_: chrome.usersPrivate, + open: function() { this.$.addUserInput.value = ''; this.onInput_(); @@ -74,11 +91,20 @@ Polymer({ userEmail = emailMatches[1] + '@' + emailMatches[2]; } - chrome.usersPrivate.addWhitelistedUser( - userEmail, - /* callback */ function(success) {}); - this.$.addUserInput.value = ''; - this.$.dialog.close(); + this.usersPrivate_.isWhitelistedUser(userEmail, doesUserExist => { + if (doesUserExist) { + // This user email had been saved previously + this.errorCode_ = UserAddError.USER_EXISTS; + return; + } + + this.$.dialog.close(); + this.usersPrivate_.addWhitelistedUser( + userEmail, + /* callback */ function(success) {}); + + this.$.addUserInput.value = ''; + }); }, /** @@ -99,6 +125,13 @@ Polymer({ const input = this.$.addUserInput.value; this.isEmail_ = NAME_ONLY_REGEX.test(input) || EMAIL_REGEX.test(input); this.isEmpty_ = input.length == 0; + + if (!this.isEmail_ && !this.isEmpty_) { + this.errorCode_ = UserAddError.INVALID_EMAIL; + return; + } + + this.errorCode_ = UserAddError.NO_ERROR; }, /** @@ -106,7 +139,20 @@ Polymer({ * @return {boolean} */ shouldShowError_: function() { - return !this.isEmail_ && !this.isEmpty_; + return this.errorCode_ != UserAddError.NO_ERROR; + }, + + /** + * @private + * @return {string} + */ + getErrorString_: function(errorCode_) { + if (errorCode_ == UserAddError.USER_EXISTS) { + return this.i18n('userExistsError'); + } + //TODO errorString for UserAddError.INVALID_EMAIL crbug/1007481 + + return ''; }, }); |