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 (function() { | 9 (function() { |
10 /** | 10 /** |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 this.browserProxy_.getAvailableIcons(); | 126 this.browserProxy_.getAvailableIcons(); |
127 this.browserProxy_.getSignedInUsers(); | 127 this.browserProxy_.getSignedInUsers(); |
128 | 128 |
129 // Alias on 'this' to use in html. | 129 // Alias on 'this' to use in html. |
130 this.NO_USER_SELECTED = NO_USER_SELECTED; | 130 this.NO_USER_SELECTED = NO_USER_SELECTED; |
131 }, | 131 }, |
132 | 132 |
133 /** | 133 /** |
134 * Handles tap events from dynamically created links in warning/error messages | 134 * Handles tap events from dynamically created links in warning/error messages |
135 * pushed by the browser. | 135 * pushed by the browser as well as the noSignedInUserMessage i18n string. |
136 * @param {!Event} event | 136 * @param {!Event} event |
137 * @private | 137 * @private |
138 */ | 138 */ |
139 onTap_: function(event) { | 139 onTap_: function(event) { |
140 var element = Polymer.dom(event).rootTarget; | 140 var element = Polymer.dom(event).rootTarget; |
141 | 141 |
142 if (element.id == 'supervised-user-import-existing') { | 142 if (element.id == 'supervised-user-import-existing') { |
143 this.onImportUserTap_(event); | 143 this.onImportUserLinkTap_(event); |
| 144 event.preventDefault(); |
| 145 } else if (element.id == 'sign-in-to-chrome') { |
| 146 this.browserProxy_.openUrlInLastActiveProfileBrowser(element.href); |
144 event.preventDefault(); | 147 event.preventDefault(); |
145 } | 148 } |
146 // TODO(mahmadi): handle tap event on '#reauth' to re-auth the custodian. | 149 // TODO(mahmadi): handle tap event on '#reauth' to re-auth the custodian. |
147 }, | 150 }, |
148 | 151 |
149 /** | 152 /** |
150 * Handler for when the profile icons are pushed from the browser. | 153 * Handler for when the profile icons are pushed from the browser. |
151 * @param {!Array<string>} iconUrls | 154 * @param {!Array<string>} iconUrls |
152 * @private | 155 * @private |
153 */ | 156 */ |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 */ | 193 */ |
191 onLearnMoreTap_: function(event) { | 194 onLearnMoreTap_: function(event) { |
192 this.fire('change-page', {page: 'supervised-learn-more-page'}); | 195 this.fire('change-page', {page: 'supervised-learn-more-page'}); |
193 }, | 196 }, |
194 | 197 |
195 /** | 198 /** |
196 * Handler for the 'Import Supervised User' link tap event. | 199 * Handler for the 'Import Supervised User' link tap event. |
197 * @param {!Event} event | 200 * @param {!Event} event |
198 * @private | 201 * @private |
199 */ | 202 */ |
200 onImportUserTap_: function(event) { | 203 onImportUserLinkTap_: function(event) { |
201 if (this.signedInUserIndex_ == NO_USER_SELECTED) { | 204 if (this.signedInUserIndex_ == NO_USER_SELECTED) { |
202 // A custodian must be selected. | 205 // A custodian must be selected. |
203 this.handleMessage_(this.i18n('custodianAccountNotSelectedError')); | 206 this.handleMessage_(this.i18n('custodianAccountNotSelectedError')); |
204 } else { | 207 } else { |
205 var signedInUser = this.signedInUser_(this.signedInUserIndex_); | 208 var signedInUser = this.signedInUser_(this.signedInUserIndex_); |
206 this.createInProgress_ = true; | 209 this.createInProgress_ = true; |
207 this.browserProxy_.getExistingSupervisedUsers(signedInUser.profilePath) | 210 this.browserProxy_.getExistingSupervisedUsers(signedInUser.profilePath) |
208 .then(this.showImportSupervisedUserPopup_.bind(this), | 211 .then(this.showImportSupervisedUserPopup_.bind(this), |
209 this.handleMessage_.bind(this)); | 212 this.handleMessage_.bind(this)); |
210 } | 213 } |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 * Computed binding that returns True if there are any signed-in users. | 415 * Computed binding that returns True if there are any signed-in users. |
413 * @param {!Array<!SignedInUser>} signedInUsers signed-in users. | 416 * @param {!Array<!SignedInUser>} signedInUsers signed-in users. |
414 * @return {boolean} | 417 * @return {boolean} |
415 * @private | 418 * @private |
416 */ | 419 */ |
417 isSignedIn_: function(signedInUsers) { | 420 isSignedIn_: function(signedInUsers) { |
418 return signedInUsers.length > 0; | 421 return signedInUsers.length > 0; |
419 } | 422 } |
420 }); | 423 }); |
421 }()); | 424 }()); |
OLD | NEW |