| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 var Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
| 7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
| 8 var ArrayDataModel = cr.ui.ArrayDataModel; | 8 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 Page.prototype.initializePage.call(this); | 35 Page.prototype.initializePage.call(this); |
| 36 | 36 |
| 37 var supervisedUserList = $('supervised-user-list'); | 37 var supervisedUserList = $('supervised-user-list'); |
| 38 options.supervisedUserOptions.SupervisedUserList.decorate( | 38 options.supervisedUserOptions.SupervisedUserList.decorate( |
| 39 supervisedUserList); | 39 supervisedUserList); |
| 40 | 40 |
| 41 var avatarGrid = $('select-avatar-grid'); | 41 var avatarGrid = $('select-avatar-grid'); |
| 42 options.ProfilesIconGrid.decorate(avatarGrid); | 42 options.ProfilesIconGrid.decorate(avatarGrid); |
| 43 var avatarIcons = loadTimeData.getValue('avatarIcons'); | 43 var avatarIcons = loadTimeData.getValue('avatarIcons'); |
| 44 avatarGrid.dataModel = new ArrayDataModel( | 44 avatarGrid.dataModel = new ArrayDataModel( |
| 45 /** @type {!Array} */(avatarIcons)); | 45 /** @type {!Array} */ (avatarIcons)); |
| 46 | 46 |
| 47 supervisedUserList.addEventListener('change', function(event) { | 47 supervisedUserList.addEventListener('change', function(event) { |
| 48 var supervisedUser = supervisedUserList.selectedItem; | 48 var supervisedUser = supervisedUserList.selectedItem; |
| 49 $('supervised-user-import-ok').disabled = | 49 $('supervised-user-import-ok').disabled = |
| 50 !supervisedUser || supervisedUser.onCurrentDevice; | 50 !supervisedUser || supervisedUser.onCurrentDevice; |
| 51 }); | 51 }); |
| 52 | 52 |
| 53 var self = this; | 53 var self = this; |
| 54 $('supervised-user-import-cancel').onclick = function(event) { | 54 $('supervised-user-import-cancel').onclick = function(event) { |
| 55 if (self.inProgress_) { | 55 if (self.inProgress_) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return; | 128 return; |
| 129 | 129 |
| 130 $('supervised-user-import-error-bubble').hidden = true; | 130 $('supervised-user-import-error-bubble').hidden = true; |
| 131 | 131 |
| 132 if ($('select-avatar-grid').hidden && supervisedUser.needAvatar) { | 132 if ($('select-avatar-grid').hidden && supervisedUser.needAvatar) { |
| 133 this.showAvatarGridHelper_(); | 133 this.showAvatarGridHelper_(); |
| 134 return; | 134 return; |
| 135 } | 135 } |
| 136 | 136 |
| 137 var avatarUrl = supervisedUser.needAvatar ? | 137 var avatarUrl = supervisedUser.needAvatar ? |
| 138 $('select-avatar-grid').selectedItem : supervisedUser.iconURL; | 138 $('select-avatar-grid').selectedItem : |
| 139 supervisedUser.iconURL; |
| 139 | 140 |
| 140 this.updateImportInProgress_(true); | 141 this.updateImportInProgress_(true); |
| 141 | 142 |
| 142 // 'createProfile' is handled by CreateProfileHandler. | 143 // 'createProfile' is handled by CreateProfileHandler. |
| 143 chrome.send('createProfile', [supervisedUser.name, avatarUrl, | 144 chrome.send( |
| 144 false, true, supervisedUser.id]); | 145 'createProfile', |
| 146 [supervisedUser.name, avatarUrl, false, true, supervisedUser.id]); |
| 145 }, | 147 }, |
| 146 | 148 |
| 147 /** | 149 /** |
| 148 * Hides the 'supervised user list' and shows the avatar grid instead. | 150 * Hides the 'supervised user list' and shows the avatar grid instead. |
| 149 * It also updates the overlay text and title to instruct the user | 151 * It also updates the overlay text and title to instruct the user |
| 150 * to choose an avatar for the supervised user. | 152 * to choose an avatar for the supervised user. |
| 151 * @private | 153 * @private |
| 152 */ | 154 */ |
| 153 showAvatarGridHelper_: function() { | 155 showAvatarGridHelper_: function() { |
| 154 this.showAppropriateElements_(/* isSelectAvatarMode */ true); | 156 this.showAppropriateElements_(/* isSelectAvatarMode */ true); |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 cr.makePublic(SupervisedUserImportOverlay, [ | 245 cr.makePublic(SupervisedUserImportOverlay, [ |
| 244 'onError', | 246 'onError', |
| 245 'onSuccess', | 247 'onSuccess', |
| 246 ]); | 248 ]); |
| 247 | 249 |
| 248 // Export | 250 // Export |
| 249 return { | 251 return { |
| 250 SupervisedUserImportOverlay: SupervisedUserImportOverlay, | 252 SupervisedUserImportOverlay: SupervisedUserImportOverlay, |
| 251 }; | 253 }; |
| 252 }); | 254 }); |
| OLD | NEW |