| OLD | NEW |
| 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 /** | 5 /** |
| 6 * @fileoverview 'create-profile' is a page that contains controls for creating | 6 * @fileoverview 'create-profile' is a page that contains controls for creating |
| 7 * a (optionally supervised) profile, including choosing a name, and an avatar. | 7 * a (optionally supervised) profile, including choosing a name, and an avatar. |
| 8 * | 8 * |
| 9 * @element create-profile | 9 * @element create-profile |
| 10 */ | 10 */ |
| 11 Polymer({ | 11 Polymer({ |
| 12 is: 'create-profile', | 12 is: 'create-profile', |
| 13 | 13 |
| 14 behaviors: [ |
| 15 I18nBehavior, |
| 16 ], |
| 17 |
| 14 properties: { | 18 properties: { |
| 15 /** | 19 /** |
| 16 * True if supervised user checkbox is disabled. | 20 * True if supervised user checkbox is disabled. |
| 17 * @private {boolean} | 21 * @private {boolean} |
| 18 */ | 22 */ |
| 19 supervisedUserCheckboxDisabled_: { | 23 supervisedUserCheckboxDisabled_: { |
| 20 type: Boolean, | 24 type: Boolean, |
| 21 computed: | 25 computed: |
| 22 'isSupervisedUserCheckboxDisabled_(createInProgress_, signedIn_)' | 26 'isSupervisedUserCheckboxDisabled_(createInProgress_, signedIn_)' |
| 23 }, | 27 }, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 handleUpdateSignedInUsers_: function(signedInUsers) { | 168 handleUpdateSignedInUsers_: function(signedInUsers) { |
| 165 this.signedInUsers_ = signedInUsers; | 169 this.signedInUsers_ = signedInUsers; |
| 166 this.signedIn_ = signedInUsers.length > 0; | 170 this.signedIn_ = signedInUsers.length > 0; |
| 167 }, | 171 }, |
| 168 | 172 |
| 169 /** | 173 /** |
| 170 * Handler for the 'Learn More' button click event. | 174 * Handler for the 'Learn More' button click event. |
| 171 * @param {!Event} event | 175 * @param {!Event} event |
| 172 * @private | 176 * @private |
| 173 */ | 177 */ |
| 174 onLearnMore_: function(event) { | 178 onLearnMoreTap_: function(event) { |
| 175 // TODO(mahmadi): fire the event to show the 'learn-more-page' | 179 this.fire('change-page', {page: 'supervised-learn-more-page'}); |
| 176 }, | 180 }, |
| 177 | 181 |
| 178 /** | 182 /** |
| 179 * Handler for the 'Ok' button click event. | 183 * Handler for the 'Ok' button click event. |
| 180 * @param {!Event} event | 184 * @param {!Event} event |
| 181 * @private | 185 * @private |
| 182 */ | 186 */ |
| 183 onOk_: function(event) { | 187 onOkTap_: function(event) { |
| 184 this.createInProgress_ = true; | 188 this.createInProgress_ = true; |
| 185 signin.ProfileApi.createProfile( | 189 signin.ProfileApi.createProfile( |
| 186 this.profileName_, this.profileIconUrl_, this.isSupervised_, | 190 this.profileName_, this.profileIconUrl_, this.isSupervised_, |
| 187 this.signedInUsers_[this.selectedEmail_].profilePath); | 191 this.signedInUsers_[this.selectedEmail_].profilePath); |
| 188 }, | 192 }, |
| 189 | 193 |
| 190 /** | 194 /** |
| 191 * Handler for the 'Cancel' button click event. | 195 * Handler for the 'Cancel' button click event. |
| 192 * @param {!Event} event | 196 * @param {!Event} event |
| 193 * @private | 197 * @private |
| 194 */ | 198 */ |
| 195 onCancel_: function(event) { | 199 onCancelTap_: function(event) { |
| 196 if (this.createInProgress_) { | 200 if (this.createInProgress_) { |
| 197 this.createInProgress_ = false; | 201 this.createInProgress_ = false; |
| 198 signin.ProfileApi.cancelCreateProfile(); | 202 signin.ProfileApi.cancelCreateProfile(); |
| 199 } else { | 203 } else { |
| 200 this.fire('change-page', {page: 'user-pods-page'}); | 204 this.fire('change-page', {page: 'user-pods-page'}); |
| 201 } | 205 } |
| 202 }, | 206 }, |
| 203 | 207 |
| 204 /** | 208 /** |
| 205 * Handler for when the user clicks a new profile icon. | 209 * Handler for when the user clicks a new profile icon. |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 * Computed binding determining whether supervised user checkbox is disabled. | 273 * Computed binding determining whether supervised user checkbox is disabled. |
| 270 * @param {boolean} createInProgress Is create in progress? | 274 * @param {boolean} createInProgress Is create in progress? |
| 271 * @param {boolean} signedIn Are there any signed-in users? | 275 * @param {boolean} signedIn Are there any signed-in users? |
| 272 * @return {boolean} | 276 * @return {boolean} |
| 273 * @private | 277 * @private |
| 274 */ | 278 */ |
| 275 isSupervisedUserCheckboxDisabled_: function(createInProgress, signedIn) { | 279 isSupervisedUserCheckboxDisabled_: function(createInProgress, signedIn) { |
| 276 return createInProgress || !signedIn; | 280 return createInProgress || !signedIn; |
| 277 } | 281 } |
| 278 }); | 282 }); |
| OLD | NEW |