Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
| 7 var ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * ManageProfileOverlay class | 10 * ManageProfileOverlay class |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 // Override the create-profile-ok and create-* keydown handlers, to avoid | 51 // Override the create-profile-ok and create-* keydown handlers, to avoid |
| 52 // closing the overlay until we finish creating the profile. | 52 // closing the overlay until we finish creating the profile. |
| 53 $('create-profile-ok').onclick = function(event) { | 53 $('create-profile-ok').onclick = function(event) { |
| 54 self.submitCreateProfile_(); | 54 self.submitCreateProfile_(); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 $('create-profile-cancel').onclick = function(event) { | 57 $('create-profile-cancel').onclick = function(event) { |
| 58 CreateProfileOverlay.cancelCreateProfile(); | 58 CreateProfileOverlay.cancelCreateProfile(); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 $('import-existing-managed-user-link').hidden = | |
| 62 !loadTimeData.getBoolean('allowCreateExistingManagedUsers'); | |
| 63 | |
| 64 $('manage-profile-cancel').onclick = | 61 $('manage-profile-cancel').onclick = |
| 65 $('delete-profile-cancel').onclick = function(event) { | 62 $('delete-profile-cancel').onclick = function(event) { |
| 66 OptionsPage.closeOverlay(); | 63 OptionsPage.closeOverlay(); |
| 67 }; | 64 }; |
| 68 $('delete-profile-ok').onclick = function(event) { | 65 $('delete-profile-ok').onclick = function(event) { |
| 69 OptionsPage.closeOverlay(); | 66 OptionsPage.closeOverlay(); |
| 70 if (BrowserOptions.getCurrentProfile().isManaged) | 67 if (BrowserOptions.getCurrentProfile().isManaged) |
| 71 return; | 68 return; |
| 72 chrome.send('deleteProfile', [self.profileInfo_.filePath]); | 69 chrome.send('deleteProfile', [self.profileInfo_.filePath]); |
| 70 options.ManagedUserListData.reloadExistingManagedUsers(); | |
|
Pam (message me for reviews)
2014/01/08 17:21:16
Since deleting a profile locally doesn't remove it
Adrian Kuegel
2014/01/09 08:56:34
There is one small change: it will have the onCurr
Pam (message me for reviews)
2014/01/09 09:00:19
Ah, yes, you're quite right!
| |
| 73 }; | 71 }; |
| 74 $('add-shortcut-button').onclick = function(event) { | 72 $('add-shortcut-button').onclick = function(event) { |
| 75 chrome.send('addProfileShortcut', [self.profileInfo_.filePath]); | 73 chrome.send('addProfileShortcut', [self.profileInfo_.filePath]); |
| 76 }; | 74 }; |
| 77 $('remove-shortcut-button').onclick = function(event) { | 75 $('remove-shortcut-button').onclick = function(event) { |
| 78 chrome.send('removeProfileShortcut', [self.profileInfo_.filePath]); | 76 chrome.send('removeProfileShortcut', [self.profileInfo_.filePath]); |
| 79 }; | 77 }; |
| 80 | 78 |
| 81 $('create-profile-managed-signed-in-learn-more-link').onclick = | 79 $('create-profile-managed-signed-in-learn-more-link').onclick = |
| 82 function(event) { | 80 function(event) { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 93 OptionsPage.closeOverlay(); | 91 OptionsPage.closeOverlay(); |
| 94 SyncSetupOverlay.startSignIn(); | 92 SyncSetupOverlay.startSignIn(); |
| 95 }; | 93 }; |
| 96 | 94 |
| 97 $('create-profile-managed-sign-in-again-link').onclick = function(event) { | 95 $('create-profile-managed-sign-in-again-link').onclick = function(event) { |
| 98 OptionsPage.closeOverlay(); | 96 OptionsPage.closeOverlay(); |
| 99 SyncSetupOverlay.showSetupUI(); | 97 SyncSetupOverlay.showSetupUI(); |
| 100 }; | 98 }; |
| 101 | 99 |
| 102 $('import-existing-managed-user-link').onclick = function(event) { | 100 $('import-existing-managed-user-link').onclick = function(event) { |
| 103 OptionsPage.closeOverlay(); | |
| 104 OptionsPage.navigateToPage('managedUserImport'); | 101 OptionsPage.navigateToPage('managedUserImport'); |
| 105 }; | 102 }; |
| 106 }, | 103 }, |
| 107 | 104 |
| 108 /** @override */ | 105 /** @override */ |
| 109 didShowPage: function() { | 106 didShowPage: function() { |
| 110 chrome.send('requestDefaultProfileIcons'); | 107 chrome.send('requestDefaultProfileIcons'); |
| 111 | 108 |
| 112 // Just ignore the manage profile dialog on Chrome OS, they use /accounts. | 109 // Just ignore the manage profile dialog on Chrome OS, they use /accounts. |
| 113 if (!cr.isChromeOS && window.location.pathname == '/manageProfile') | 110 if (!cr.isChromeOS && window.location.pathname == '/manageProfile') |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 127 var manageNameField = $('manage-profile-name'); | 124 var manageNameField = $('manage-profile-name'); |
| 128 // Supervised users cannot edit their names. | 125 // Supervised users cannot edit their names. |
| 129 if (manageNameField.disabled) | 126 if (manageNameField.disabled) |
| 130 $('manage-profile-ok').focus(); | 127 $('manage-profile-ok').focus(); |
| 131 else | 128 else |
| 132 manageNameField.focus(); | 129 manageNameField.focus(); |
| 133 }, | 130 }, |
| 134 | 131 |
| 135 /** | 132 /** |
| 136 * Registers event handlers that are common between create and manage modes. | 133 * Registers event handlers that are common between create and manage modes. |
| 137 * @param {string} mode A label that specifies the type of dialog | 134 * @param {string} mode A label that specifies the type of dialog box which |
| 138 * box which is currently being viewed (i.e. 'create' or | 135 * is currently being viewed (i.e. 'create' or 'manage'). |
| 139 * 'manage'). | |
| 140 * @param {function()} submitFunction The function that should be called | 136 * @param {function()} submitFunction The function that should be called |
| 141 * when the user chooses to submit (e.g. by clicking the OK button). | 137 * when the user chooses to submit (e.g. by clicking the OK button). |
| 142 * @private | 138 * @private |
| 143 */ | 139 */ |
| 144 registerCommonEventHandlers_: function(mode, submitFunction) { | 140 registerCommonEventHandlers_: function(mode, submitFunction) { |
| 145 var self = this; | 141 var self = this; |
| 146 $(mode + '-profile-icon-grid').addEventListener('change', function(e) { | 142 $(mode + '-profile-icon-grid').addEventListener('change', function(e) { |
| 147 self.onIconGridSelectionChanged_(mode); | 143 self.onIconGridSelectionChanged_(mode); |
| 148 }); | 144 }); |
| 149 $(mode + '-profile-name').oninput = function(event) { | 145 $(mode + '-profile-name').oninput = function(event) { |
| 150 self.onNameChanged_(event, mode); | 146 self.onNameChanged_(mode); |
| 151 }; | 147 }; |
| 152 $(mode + '-profile-ok').onclick = function(event) { | 148 $(mode + '-profile-ok').onclick = function(event) { |
| 153 OptionsPage.closeOverlay(); | 149 OptionsPage.closeOverlay(); |
| 154 submitFunction(); | 150 submitFunction(); |
| 155 }; | 151 }; |
| 156 }, | 152 }, |
| 157 | 153 |
| 158 /** | 154 /** |
| 159 * Set the profile info used in the dialog. | 155 * Set the profile info used in the dialog. |
| 160 * @param {Object} profileInfo An object of the form: | 156 * @param {Object} profileInfo An object of the form: |
| 161 * profileInfo = { | 157 * profileInfo = { |
| 162 * name: "Profile Name", | 158 * name: "Profile Name", |
| 163 * iconURL: "chrome://path/to/icon/image", | 159 * iconURL: "chrome://path/to/icon/image", |
| 164 * filePath: "/path/to/profile/data/on/disk", | 160 * filePath: "/path/to/profile/data/on/disk", |
| 165 * isCurrentProfile: false, | 161 * isCurrentProfile: false, |
| 166 * isManaged: false | 162 * isManaged: false |
| 167 * }; | 163 * }; |
| 168 * @param {string} mode A label that specifies the type of dialog | 164 * @param {string} mode A label that specifies the type of dialog box which |
| 169 * box which is currently being viewed (i.e. 'create' or | 165 * is currently being viewed (i.e. 'create' or 'manage'). |
| 170 * 'manage'). | |
| 171 * @private | 166 * @private |
| 172 */ | 167 */ |
| 173 setProfileInfo_: function(profileInfo, mode) { | 168 setProfileInfo_: function(profileInfo, mode) { |
| 174 this.iconGridSelectedURL_ = profileInfo.iconURL; | 169 this.iconGridSelectedURL_ = profileInfo.iconURL; |
| 175 this.profileInfo_ = profileInfo; | 170 this.profileInfo_ = profileInfo; |
| 176 $(mode + '-profile-name').value = profileInfo.name; | 171 $(mode + '-profile-name').value = profileInfo.name; |
| 177 $(mode + '-profile-icon-grid').selectedItem = profileInfo.iconURL; | 172 $(mode + '-profile-icon-grid').selectedItem = profileInfo.iconURL; |
| 178 }, | 173 }, |
| 179 | 174 |
| 180 /** | 175 /** |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 * message. | 244 * message. |
| 250 * @param {boolean} hasShortcuts Whether profile has any existing shortcuts. | 245 * @param {boolean} hasShortcuts Whether profile has any existing shortcuts. |
| 251 * @private | 246 * @private |
| 252 */ | 247 */ |
| 253 receiveHasProfileShortcuts_: function(hasShortcuts) { | 248 receiveHasProfileShortcuts_: function(hasShortcuts) { |
| 254 $('add-shortcut-button').hidden = hasShortcuts; | 249 $('add-shortcut-button').hidden = hasShortcuts; |
| 255 $('remove-shortcut-button').hidden = !hasShortcuts; | 250 $('remove-shortcut-button').hidden = !hasShortcuts; |
| 256 }, | 251 }, |
| 257 | 252 |
| 258 /** | 253 /** |
| 259 * Display the error bubble, with |errorText| in the bubble. | 254 * Display the error bubble, with |errorHtml| in the bubble. |
| 260 * @param {string} errorText The string to display as an error. | 255 * @param {string} errorHtml The html string to display as an error. |
| 261 * @param {string} mode A label that specifies the type of dialog | 256 * @param {string} mode A label that specifies the type of dialog box which |
| 262 * box which is currently being viewed (i.e. 'create' or | 257 * is currently being viewed (i.e. 'create' or 'manage'). |
| 263 * 'manage'). | |
| 264 * @param {boolean} disableOKButton True if the dialog's OK button should be | 258 * @param {boolean} disableOKButton True if the dialog's OK button should be |
| 265 * disabled when the error bubble is shown. It will be (re-)enabled when | 259 * disabled when the error bubble is shown. It will be (re-)enabled when |
| 266 * the error bubble is hidden. | 260 * the error bubble is hidden. |
| 267 * @private | 261 * @private |
| 268 */ | 262 */ |
| 269 showErrorBubble_: function(errorText, mode, disableOKButton) { | 263 showErrorBubble_: function(errorHtml, mode, disableOKButton) { |
| 270 var nameErrorEl = $(mode + '-profile-error-bubble'); | 264 var nameErrorEl = $(mode + '-profile-error-bubble'); |
| 271 nameErrorEl.hidden = false; | 265 nameErrorEl.hidden = false; |
| 272 nameErrorEl.textContent = errorText; | 266 nameErrorEl.innerHTML = errorHtml; |
| 273 | 267 |
| 274 if (disableOKButton) | 268 if (disableOKButton) |
| 275 $(mode + '-profile-ok').disabled = true; | 269 $(mode + '-profile-ok').disabled = true; |
| 276 }, | 270 }, |
| 277 | 271 |
| 278 /** | 272 /** |
| 279 * Hide the error bubble. | 273 * Hide the error bubble. |
| 280 * @param {string} mode A label that specifies the type of dialog | 274 * @param {string} mode A label that specifies the type of dialog box which |
| 281 * box which is currently being viewed (i.e. 'create' or | 275 * is currently being viewed (i.e. 'create' or 'manage'). |
| 282 * 'manage'). | |
| 283 * @private | 276 * @private |
| 284 */ | 277 */ |
| 285 hideErrorBubble_: function(mode) { | 278 hideErrorBubble_: function(mode) { |
| 286 $(mode + '-profile-error-bubble').hidden = true; | 279 $(mode + '-profile-error-bubble').hidden = true; |
| 287 $(mode + '-profile-ok').disabled = false; | 280 $(mode + '-profile-ok').disabled = false; |
| 288 }, | 281 }, |
| 289 | 282 |
| 290 /** | 283 /** |
| 291 * oninput callback for <input> field. | 284 * oninput callback for <input> field. |
| 292 * @param {Event} event The event object. | 285 * @param {string} mode A label that specifies the type of dialog box which |
| 293 * @param {string} mode A label that specifies the type of dialog | 286 * is currently being viewed (i.e. 'create' or 'manage'). |
| 294 * box which is currently being viewed (i.e. 'create' or | |
| 295 * 'manage'). | |
| 296 * @private | 287 * @private |
| 297 */ | 288 */ |
| 298 onNameChanged_: function(event, mode) { | 289 onNameChanged_: function(mode) { |
| 299 var newName = event.target.value; | 290 var newName = $(mode + '-profile-name').value; |
| 300 var oldName = this.profileInfo_.name; | 291 var oldName = this.profileInfo_.name; |
| 301 | 292 |
| 302 if (newName == oldName) { | 293 // In 'create' mode, the initial name can be the name of an already |
| 294 // existing supervised user. | |
| 295 if (newName == oldName && mode == 'manage') { | |
| 303 this.hideErrorBubble_(mode); | 296 this.hideErrorBubble_(mode); |
| 304 } else if (this.profileNames_[newName] != undefined) { | 297 } else if (this.profileNames_[newName] != undefined) { |
| 305 var errorText = | 298 var errorHtml = |
| 306 loadTimeData.getString('manageProfilesDuplicateNameError'); | 299 loadTimeData.getString('manageProfilesDuplicateNameError'); |
| 307 this.showErrorBubble_(errorText, mode, true); | 300 this.showErrorBubble_(errorHtml, mode, true); |
| 301 } else if (mode == 'create' && | |
| 302 loadTimeData.getBoolean('allowCreateExistingManagedUsers')) { | |
| 303 this.checkIfSupervisedUserExists_(); | |
| 308 } else { | 304 } else { |
| 309 this.hideErrorBubble_(mode); | 305 this.updateOkButton_(mode); |
| 310 | |
| 311 var nameIsValid = $(mode + '-profile-name').validity.valid; | |
| 312 $(mode + '-profile-ok').disabled = !nameIsValid; | |
| 313 } | 306 } |
| 314 }, | 307 }, |
| 315 | 308 |
| 316 /** | 309 /** |
| 310 * Checks if a supervised user with the currently entered name already | |
| 311 * exists. | |
| 312 * @private | |
| 313 */ | |
| 314 checkIfSupervisedUserExists_: function() { | |
| 315 if (!$('create-profile-managed').checked) { | |
| 316 this.updateOkButton_('create'); | |
| 317 return; | |
| 318 } | |
| 319 options.ManagedUserListData.requestExistingManagedUsers( | |
| 320 this.receiveExistingManagedUsers_.bind(this), | |
| 321 this.onSigninError_.bind(this)); | |
| 322 }, | |
| 323 | |
| 324 /** | |
| 325 * Callback which receives the list of existing managed users. Checks if the | |
| 326 * currently entered name is the name of an already existing managed user. | |
| 327 * If yes, the user is prompted to import the existing managed user, and the | |
| 328 * create button is disabled. | |
| 329 * @param {Array.<Object>} The list of existing managed users. | |
| 330 * @private | |
| 331 */ | |
| 332 receiveExistingManagedUsers_: function(managedUsers) { | |
| 333 var newName = $('create-profile-name').value; | |
| 334 var i; | |
| 335 for (i = 0; i < managedUsers.length; ++i) { | |
| 336 if (managedUsers[i].name == newName && | |
| 337 !managedUsers[i].onCurrentDevice) { | |
| 338 var errorHtml = loadTimeData.getStringF( | |
| 339 'manageProfilesExistingSupervisedUser', | |
| 340 HTMLEscape(elide(newName, /* maxLength */ 50))); | |
| 341 this.showErrorBubble_(errorHtml, 'create', true); | |
| 342 | |
| 343 // Check if another supervised user also exists with that name. | |
| 344 var nameIsUnique = true; | |
| 345 var j; | |
| 346 for (j = i + 1; j < managedUsers.length; ++j) { | |
| 347 if (managedUsers[j].name == newName) { | |
| 348 nameIsUnique = false; | |
| 349 break; | |
| 350 } | |
| 351 } | |
| 352 function getImportHandler(managedUser, nameIsUnique) { | |
| 353 return function() { | |
| 354 if (managedUser.needAvatar || !nameIsUnique) { | |
| 355 OptionsPage.navigateToPage('managedUserImport'); | |
| 356 } else { | |
| 357 chrome.send('createProfile', | |
| 358 [managedUser.name, managedUser.iconURL, false, true, | |
| 359 managedUser.id]); | |
| 360 } | |
| 361 } | |
| 362 }; | |
| 363 $('supervised-user-import').onclick = | |
| 364 getImportHandler(managedUsers[i], nameIsUnique); | |
| 365 $('create-profile-ok').disabled = true; | |
| 366 return; | |
| 367 } | |
| 368 } | |
| 369 this.updateOkButton_('create'); | |
| 370 }, | |
| 371 | |
| 372 /** | |
| 373 * Called in case the request for the list of managed users fails because of | |
| 374 * a signin error. | |
| 375 * @private | |
| 376 */ | |
| 377 onSigninError_: function() { | |
| 378 this.updateImportExistingManagedUserLink_(false); | |
| 379 this.updateManagedUsersAllowed_(false); | |
| 380 }, | |
| 381 | |
| 382 /** | |
| 383 * Called if the name seems to be unused so far. | |
| 384 * @param {string} mode A label that specifies the type of dialog box which | |
| 385 * is currently being viewed (i.e. 'create' or 'manage'). | |
| 386 * @private | |
| 387 */ | |
| 388 updateOkButton_: function(mode) { | |
| 389 this.hideErrorBubble_(mode); | |
| 390 | |
| 391 var nameIsValid = $(mode + '-profile-name').validity.valid; | |
| 392 $(mode + '-profile-ok').disabled = !nameIsValid; | |
| 393 }, | |
| 394 | |
| 395 /** | |
| 317 * Called when the user clicks "OK" or hits enter. Saves the newly changed | 396 * Called when the user clicks "OK" or hits enter. Saves the newly changed |
| 318 * profile info. | 397 * profile info. |
| 319 * @private | 398 * @private |
| 320 */ | 399 */ |
| 321 submitManageChanges_: function() { | 400 submitManageChanges_: function() { |
| 322 var name = $('manage-profile-name').value; | 401 var name = $('manage-profile-name').value; |
| 323 var iconURL = $('manage-profile-icon-grid').selectedItem; | 402 var iconURL = $('manage-profile-icon-grid').selectedItem; |
| 324 | 403 |
| 325 chrome.send('setProfileIconAndName', | 404 chrome.send('setProfileIconAndName', |
| 326 [this.profileInfo_.filePath, iconURL, name]); | 405 [this.profileInfo_.filePath, iconURL, name]); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 349 var existingManagedUserId = ''; | 428 var existingManagedUserId = ''; |
| 350 | 429 |
| 351 // 'createProfile' is handled by the CreateProfileHandler. | 430 // 'createProfile' is handled by the CreateProfileHandler. |
| 352 chrome.send('createProfile', | 431 chrome.send('createProfile', |
| 353 [name, iconUrl, createShortcut, | 432 [name, iconUrl, createShortcut, |
| 354 isManaged, existingManagedUserId]); | 433 isManaged, existingManagedUserId]); |
| 355 }, | 434 }, |
| 356 | 435 |
| 357 /** | 436 /** |
| 358 * Called when the selected icon in the icon grid changes. | 437 * Called when the selected icon in the icon grid changes. |
| 359 * @param {string} mode A label that specifies the type of dialog | 438 * @param {string} mode A label that specifies the type of dialog box which |
| 360 * box which is currently being viewed (i.e. 'create' or | 439 * is currently being viewed (i.e. 'create' or 'manage'). |
| 361 * 'manage'). | |
| 362 * @private | 440 * @private |
| 363 */ | 441 */ |
| 364 onIconGridSelectionChanged_: function(mode) { | 442 onIconGridSelectionChanged_: function(mode) { |
| 365 var iconURL = $(mode + '-profile-icon-grid').selectedItem; | 443 var iconURL = $(mode + '-profile-icon-grid').selectedItem; |
| 366 if (!iconURL || iconURL == this.iconGridSelectedURL_) | 444 if (!iconURL || iconURL == this.iconGridSelectedURL_) |
| 367 return; | 445 return; |
| 368 this.iconGridSelectedURL_ = iconURL; | 446 this.iconGridSelectedURL_ = iconURL; |
| 369 if (this.profileInfo_ && this.profileInfo_.filePath) { | 447 if (this.profileInfo_ && this.profileInfo_.filePath) { |
| 370 chrome.send('profileIconSelectionChanged', | 448 chrome.send('profileIconSelectionChanged', |
| 371 [this.profileInfo_.filePath, iconURL]); | 449 [this.profileInfo_.filePath, iconURL]); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 405 if (BrowserOptions.getCurrentProfile().isManaged) | 483 if (BrowserOptions.getCurrentProfile().isManaged) |
| 406 return; | 484 return; |
| 407 | 485 |
| 408 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); | 486 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); |
| 409 $('manage-profile-overlay-create').hidden = true; | 487 $('manage-profile-overlay-create').hidden = true; |
| 410 $('manage-profile-overlay-manage').hidden = true; | 488 $('manage-profile-overlay-manage').hidden = true; |
| 411 $('manage-profile-overlay-delete').hidden = false; | 489 $('manage-profile-overlay-delete').hidden = false; |
| 412 $('delete-profile-icon').style.content = | 490 $('delete-profile-icon').style.content = |
| 413 imageset(profileInfo.iconURL + '@scalefactorx'); | 491 imageset(profileInfo.iconURL + '@scalefactorx'); |
| 414 $('delete-profile-text').textContent = | 492 $('delete-profile-text').textContent = |
| 415 loadTimeData.getStringF('deleteProfileMessage', profileInfo.name); | 493 loadTimeData.getStringF('deleteProfileMessage', |
| 494 elide(profileInfo.name, /* maxLength */ 50)); | |
| 416 $('delete-managed-profile-addendum').hidden = !profileInfo.isManaged; | 495 $('delete-managed-profile-addendum').hidden = !profileInfo.isManaged; |
| 417 | 496 |
| 418 // Because this dialog isn't useful when refreshing or as part of the | 497 // Because this dialog isn't useful when refreshing or as part of the |
| 419 // history, don't create a history entry for it when showing. | 498 // history, don't create a history entry for it when showing. |
| 420 OptionsPage.showPageByName('manageProfile', false); | 499 OptionsPage.showPageByName('manageProfile', false); |
| 421 }, | 500 }, |
| 422 | 501 |
| 423 /** | 502 /** |
| 424 * Display the "Create Profile" dialog. | 503 * Display the "Create Profile" dialog. |
| 425 * @private | 504 * @private |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 487 | 566 |
| 488 var shortcutsEnabled = loadTimeData.getBoolean('profileShortcutsEnabled'); | 567 var shortcutsEnabled = loadTimeData.getBoolean('profileShortcutsEnabled'); |
| 489 $('create-shortcut-container').hidden = !shortcutsEnabled; | 568 $('create-shortcut-container').hidden = !shortcutsEnabled; |
| 490 $('create-shortcut').checked = shortcutsEnabled; | 569 $('create-shortcut').checked = shortcutsEnabled; |
| 491 | 570 |
| 492 $('create-profile-name-label').hidden = true; | 571 $('create-profile-name-label').hidden = true; |
| 493 $('create-profile-name').hidden = true; | 572 $('create-profile-name').hidden = true; |
| 494 $('create-profile-ok').disabled = true; | 573 $('create-profile-ok').disabled = true; |
| 495 | 574 |
| 496 $('create-profile-managed').checked = false; | 575 $('create-profile-managed').checked = false; |
| 576 if (loadTimeData.getBoolean('allowCreateExistingManagedUsers')) { | |
| 577 $('import-existing-managed-user-link').hidden = false; | |
| 578 $('create-profile-managed').onchange = function() { | |
| 579 ManageProfileOverlay.getInstance().onNameChanged_('create'); | |
| 580 }; | |
| 581 } | |
| 497 $('create-profile-managed-signed-in').disabled = true; | 582 $('create-profile-managed-signed-in').disabled = true; |
| 498 $('create-profile-managed-signed-in').hidden = true; | 583 $('create-profile-managed-signed-in').hidden = true; |
| 499 $('create-profile-managed-not-signed-in').hidden = true; | 584 $('create-profile-managed-not-signed-in').hidden = true; |
| 500 }, | 585 }, |
| 501 | 586 |
| 502 /** @override */ | 587 /** @override */ |
| 503 handleCancel: function() { | 588 handleCancel: function() { |
| 504 this.cancelCreateProfile_(); | 589 this.cancelCreateProfile_(); |
| 505 }, | 590 }, |
| 506 | 591 |
| 507 /** @override */ | 592 /** @override */ |
| 508 showErrorBubble_: function(errorText) { | 593 showErrorBubble_: function(errorHtml) { |
| 509 ManageProfileOverlay.getInstance().showErrorBubble_(errorText, | 594 ManageProfileOverlay.getInstance().showErrorBubble_(errorHtml, |
| 510 'create', | 595 'create', |
| 511 false); | 596 false); |
| 512 }, | 597 }, |
| 513 | 598 |
| 514 /** @override */ | 599 /** @override */ |
| 515 hideErrorBubble_: function() { | 600 hideErrorBubble_: function() { |
| 516 ManageProfileOverlay.getInstance().hideErrorBubble_('create'); | 601 ManageProfileOverlay.getInstance().hideErrorBubble_('create'); |
| 517 }, | 602 }, |
| 518 | 603 |
| 519 /** | 604 /** |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 * name: "Profile Name", | 663 * name: "Profile Name", |
| 579 * filePath: "/path/to/profile/data/on/disk" | 664 * filePath: "/path/to/profile/data/on/disk" |
| 580 * isManaged: (true|false), | 665 * isManaged: (true|false), |
| 581 * }; | 666 * }; |
| 582 * @private | 667 * @private |
| 583 */ | 668 */ |
| 584 onSuccess_: function(profileInfo) { | 669 onSuccess_: function(profileInfo) { |
| 585 this.updateCreateInProgress_(false); | 670 this.updateCreateInProgress_(false); |
| 586 OptionsPage.closeOverlay(); | 671 OptionsPage.closeOverlay(); |
| 587 if (profileInfo.isManaged) { | 672 if (profileInfo.isManaged) { |
| 673 options.ManagedUserListData.reloadExistingManagedUsers(); | |
| 588 profileInfo.custodianEmail = this.signedInEmail_; | 674 profileInfo.custodianEmail = this.signedInEmail_; |
| 589 ManagedUserCreateConfirmOverlay.setProfileInfo(profileInfo); | 675 ManagedUserCreateConfirmOverlay.setProfileInfo(profileInfo); |
| 590 OptionsPage.showPageByName('managedUserCreateConfirm', false); | 676 OptionsPage.showPageByName('managedUserCreateConfirm', false); |
| 591 BrowserOptions.updateManagesSupervisedUsers(true); | 677 BrowserOptions.updateManagesSupervisedUsers(true); |
| 592 } | 678 } |
| 593 }, | 679 }, |
| 594 | 680 |
| 595 /** | 681 /** |
| 596 * Updates the signed-in or not-signed-in UI when in create mode. Called by | 682 * Updates the signed-in or not-signed-in UI when in create mode. Called by |
| 597 * the handler in response to the 'requestCreateProfileUpdate' message. | 683 * the handler in response to the 'requestCreateProfileUpdate' message. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 695 return instance[name + '_'].apply(instance, arguments); | 781 return instance[name + '_'].apply(instance, arguments); |
| 696 }; | 782 }; |
| 697 }); | 783 }); |
| 698 | 784 |
| 699 // Export | 785 // Export |
| 700 return { | 786 return { |
| 701 ManageProfileOverlay: ManageProfileOverlay, | 787 ManageProfileOverlay: ManageProfileOverlay, |
| 702 CreateProfileOverlay: CreateProfileOverlay, | 788 CreateProfileOverlay: CreateProfileOverlay, |
| 703 }; | 789 }; |
| 704 }); | 790 }); |
| OLD | NEW |