| 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 Page = cr.ui.pageManager.Page; |
| 7 var PageManager = cr.ui.pageManager.PageManager; |
| 7 var ArrayDataModel = cr.ui.ArrayDataModel; | 8 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 | 9 |
| 9 /** | 10 /** |
| 10 * ManageProfileOverlay class | 11 * ManageProfileOverlay class |
| 11 * Encapsulated handling of the 'Manage profile...' overlay page. | 12 * Encapsulated handling of the 'Manage profile...' overlay page. |
| 12 * @constructor | 13 * @constructor |
| 13 * @class | 14 * @class |
| 14 */ | 15 */ |
| 15 function ManageProfileOverlay() { | 16 function ManageProfileOverlay() { |
| 16 OptionsPage.call(this, 'manageProfile', | 17 Page.call(this, 'manageProfile', |
| 17 loadTimeData.getString('manageProfileTabTitle'), | 18 loadTimeData.getString('manageProfileTabTitle'), |
| 18 'manage-profile-overlay'); | 19 'manage-profile-overlay'); |
| 19 }; | 20 }; |
| 20 | 21 |
| 21 cr.addSingletonGetter(ManageProfileOverlay); | 22 cr.addSingletonGetter(ManageProfileOverlay); |
| 22 | 23 |
| 23 ManageProfileOverlay.prototype = { | 24 ManageProfileOverlay.prototype = { |
| 24 // Inherit from OptionsPage. | 25 // Inherit from Page. |
| 25 __proto__: OptionsPage.prototype, | 26 __proto__: Page.prototype, |
| 26 | 27 |
| 27 // Info about the currently managed/deleted profile. | 28 // Info about the currently managed/deleted profile. |
| 28 profileInfo_: null, | 29 profileInfo_: null, |
| 29 | 30 |
| 30 // Whether the currently chosen name for a new profile was assigned | 31 // Whether the currently chosen name for a new profile was assigned |
| 31 // automatically by choosing an avatar. Set on receiveNewProfileDefaults; | 32 // automatically by choosing an avatar. Set on receiveNewProfileDefaults; |
| 32 // cleared on first edit (in onNameChanged_). | 33 // cleared on first edit (in onNameChanged_). |
| 33 profileNameIsDefault_: false, | 34 profileNameIsDefault_: false, |
| 34 | 35 |
| 35 // List of default profile names corresponding to the respective icons. | 36 // List of default profile names corresponding to the respective icons. |
| 36 defaultProfileNames_: [], | 37 defaultProfileNames_: [], |
| 37 | 38 |
| 38 // An object containing all names of existing profiles. | 39 // An object containing all names of existing profiles. |
| 39 existingProfileNames_: {}, | 40 existingProfileNames_: {}, |
| 40 | 41 |
| 41 // The currently selected icon in the icon grid. | 42 // The currently selected icon in the icon grid. |
| 42 iconGridSelectedURL_: null, | 43 iconGridSelectedURL_: null, |
| 43 | 44 |
| 44 /** @override */ | 45 /** @override */ |
| 45 initializePage: function() { | 46 initializePage: function() { |
| 46 // Call base class implementation to start preference initialization. | 47 Page.prototype.initializePage.call(this); |
| 47 OptionsPage.prototype.initializePage.call(this); | |
| 48 | 48 |
| 49 var self = this; | 49 var self = this; |
| 50 options.ProfilesIconGrid.decorate($('manage-profile-icon-grid')); | 50 options.ProfilesIconGrid.decorate($('manage-profile-icon-grid')); |
| 51 options.ProfilesIconGrid.decorate($('create-profile-icon-grid')); | 51 options.ProfilesIconGrid.decorate($('create-profile-icon-grid')); |
| 52 self.registerCommonEventHandlers_('create', | 52 self.registerCommonEventHandlers_('create', |
| 53 self.submitCreateProfile_.bind(self)); | 53 self.submitCreateProfile_.bind(self)); |
| 54 self.registerCommonEventHandlers_('manage', | 54 self.registerCommonEventHandlers_('manage', |
| 55 self.submitManageChanges_.bind(self)); | 55 self.submitManageChanges_.bind(self)); |
| 56 | 56 |
| 57 // Override the create-profile-ok and create-* keydown handlers, to avoid | 57 // Override the create-profile-ok and create-* keydown handlers, to avoid |
| 58 // closing the overlay until we finish creating the profile. | 58 // closing the overlay until we finish creating the profile. |
| 59 $('create-profile-ok').onclick = function(event) { | 59 $('create-profile-ok').onclick = function(event) { |
| 60 self.submitCreateProfile_(); | 60 self.submitCreateProfile_(); |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 $('create-profile-cancel').onclick = function(event) { | 63 $('create-profile-cancel').onclick = function(event) { |
| 64 CreateProfileOverlay.cancelCreateProfile(); | 64 CreateProfileOverlay.cancelCreateProfile(); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 $('manage-profile-cancel').onclick = | 67 $('manage-profile-cancel').onclick = |
| 68 $('disconnect-managed-profile-cancel').onclick = | 68 $('disconnect-managed-profile-cancel').onclick = |
| 69 $('delete-profile-cancel').onclick = function(event) { | 69 $('delete-profile-cancel').onclick = function(event) { |
| 70 OptionsPage.closeOverlay(); | 70 PageManager.closeOverlay(); |
| 71 }; | 71 }; |
| 72 $('delete-profile-ok').onclick = function(event) { | 72 $('delete-profile-ok').onclick = function(event) { |
| 73 OptionsPage.closeOverlay(); | 73 PageManager.closeOverlay(); |
| 74 if (BrowserOptions.getCurrentProfile().isSupervised) | 74 if (BrowserOptions.getCurrentProfile().isSupervised) |
| 75 return; | 75 return; |
| 76 chrome.send('deleteProfile', [self.profileInfo_.filePath]); | 76 chrome.send('deleteProfile', [self.profileInfo_.filePath]); |
| 77 options.SupervisedUserListData.resetPromise(); | 77 options.SupervisedUserListData.resetPromise(); |
| 78 }; | 78 }; |
| 79 $('add-shortcut-button').onclick = function(event) { | 79 $('add-shortcut-button').onclick = function(event) { |
| 80 chrome.send('addProfileShortcut', [self.profileInfo_.filePath]); | 80 chrome.send('addProfileShortcut', [self.profileInfo_.filePath]); |
| 81 }; | 81 }; |
| 82 $('remove-shortcut-button').onclick = function(event) { | 82 $('remove-shortcut-button').onclick = function(event) { |
| 83 chrome.send('removeProfileShortcut', [self.profileInfo_.filePath]); | 83 chrome.send('removeProfileShortcut', [self.profileInfo_.filePath]); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 $('disconnect-managed-profile-ok').onclick = function(event) { | 86 $('disconnect-managed-profile-ok').onclick = function(event) { |
| 87 OptionsPage.closeOverlay(); | 87 PageManager.closeOverlay(); |
| 88 chrome.send('deleteProfile', | 88 chrome.send('deleteProfile', |
| 89 [BrowserOptions.getCurrentProfile().filePath]); | 89 [BrowserOptions.getCurrentProfile().filePath]); |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 $('create-profile-supervised-signed-in-learn-more-link').onclick = | 92 $('create-profile-supervised-signed-in-learn-more-link').onclick = |
| 93 function(event) { | 93 function(event) { |
| 94 OptionsPage.navigateToPage('supervisedUserLearnMore'); | 94 PageManager.showPageByName('supervisedUserLearnMore'); |
| 95 return false; | 95 return false; |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 $('create-profile-supervised-not-signed-in-link').onclick = | 98 $('create-profile-supervised-not-signed-in-link').onclick = |
| 99 function(event) { | 99 function(event) { |
| 100 // The signin process will open an overlay to configure sync, which | 100 // The signin process will open an overlay to configure sync, which |
| 101 // would replace this overlay. It's smoother to close this one now. | 101 // would replace this overlay. It's smoother to close this one now. |
| 102 // TODO(pamg): Move the sync-setup overlay to a higher layer so this one | 102 // TODO(pamg): Move the sync-setup overlay to a higher layer so this one |
| 103 // can stay open under it, after making sure that doesn't break anything | 103 // can stay open under it, after making sure that doesn't break anything |
| 104 // else. | 104 // else. |
| 105 OptionsPage.closeOverlay(); | 105 PageManager.closeOverlay(); |
| 106 SyncSetupOverlay.startSignIn(); | 106 SyncSetupOverlay.startSignIn(); |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 $('create-profile-supervised-sign-in-again-link').onclick = | 109 $('create-profile-supervised-sign-in-again-link').onclick = |
| 110 function(event) { | 110 function(event) { |
| 111 OptionsPage.closeOverlay(); | 111 PageManager.closeOverlay(); |
| 112 SyncSetupOverlay.showSetupUI(); | 112 SyncSetupOverlay.showSetupUI(); |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 $('import-existing-supervised-user-link').onclick = function(event) { | 115 $('import-existing-supervised-user-link').onclick = function(event) { |
| 116 // Hide the import button to trigger a cursor update. The import button | 116 // Hide the import button to trigger a cursor update. The import button |
| 117 // is shown again when the import overlay loads. TODO(akuegel): Remove | 117 // is shown again when the import overlay loads. TODO(akuegel): Remove |
| 118 // this temporary fix when crbug/246304 is resolved. | 118 // this temporary fix when crbug/246304 is resolved. |
| 119 $('import-existing-supervised-user-link').hidden = true; | 119 $('import-existing-supervised-user-link').hidden = true; |
| 120 OptionsPage.navigateToPage('supervisedUserImport'); | 120 PageManager.showPageByName('managedUserImport'); |
| 121 }; | 121 }; |
| 122 }, | 122 }, |
| 123 | 123 |
| 124 /** @override */ | 124 /** @override */ |
| 125 didShowPage: function() { | 125 didShowPage: function() { |
| 126 chrome.send('requestDefaultProfileIcons', ['manage']); | 126 chrome.send('requestDefaultProfileIcons', ['manage']); |
| 127 | 127 |
| 128 // Just ignore the manage profile dialog on Chrome OS, they use /accounts. | 128 // Just ignore the manage profile dialog on Chrome OS, they use /accounts. |
| 129 if (!cr.isChromeOS && window.location.pathname == '/manageProfile') | 129 if (!cr.isChromeOS && window.location.pathname == '/manageProfile') |
| 130 ManageProfileOverlay.getInstance().prepareForManageDialog_(); | 130 ManageProfileOverlay.getInstance().prepareForManageDialog_(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 160 */ | 160 */ |
| 161 registerCommonEventHandlers_: function(mode, submitFunction) { | 161 registerCommonEventHandlers_: function(mode, submitFunction) { |
| 162 var self = this; | 162 var self = this; |
| 163 $(mode + '-profile-icon-grid').addEventListener('change', function(e) { | 163 $(mode + '-profile-icon-grid').addEventListener('change', function(e) { |
| 164 self.onIconGridSelectionChanged_(mode); | 164 self.onIconGridSelectionChanged_(mode); |
| 165 }); | 165 }); |
| 166 $(mode + '-profile-name').oninput = function(event) { | 166 $(mode + '-profile-name').oninput = function(event) { |
| 167 self.onNameChanged_(mode); | 167 self.onNameChanged_(mode); |
| 168 }; | 168 }; |
| 169 $(mode + '-profile-ok').onclick = function(event) { | 169 $(mode + '-profile-ok').onclick = function(event) { |
| 170 OptionsPage.closeOverlay(); | 170 PageManager.closeOverlay(); |
| 171 submitFunction(); | 171 submitFunction(); |
| 172 }; | 172 }; |
| 173 }, | 173 }, |
| 174 | 174 |
| 175 /** | 175 /** |
| 176 * Set the profile info used in the dialog. | 176 * Set the profile info used in the dialog. |
| 177 * @param {Object} profileInfo An object of the form: | 177 * @param {Object} profileInfo An object of the form: |
| 178 * profileInfo = { | 178 * profileInfo = { |
| 179 * name: "Profile Name", | 179 * name: "Profile Name", |
| 180 * iconURL: "chrome://path/to/icon/image", | 180 * iconURL: "chrome://path/to/icon/image", |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 ManageProfileOverlay.setProfileInfo(profileInfo, 'create'); | 245 ManageProfileOverlay.setProfileInfo(profileInfo, 'create'); |
| 246 this.profileNameIsDefault_ = true; | 246 this.profileNameIsDefault_ = true; |
| 247 $('create-profile-name-label').hidden = false; | 247 $('create-profile-name-label').hidden = false; |
| 248 $('create-profile-name').hidden = false; | 248 $('create-profile-name').hidden = false; |
| 249 // Trying to change the focus if this isn't the topmost overlay can | 249 // Trying to change the focus if this isn't the topmost overlay can |
| 250 // instead cause the FocusManager to override another overlay's focus, | 250 // instead cause the FocusManager to override another overlay's focus, |
| 251 // e.g. if an overlay above this one is in the process of being reloaded. | 251 // e.g. if an overlay above this one is in the process of being reloaded. |
| 252 // But the C++ handler calls this method directly on ManageProfileOverlay, | 252 // But the C++ handler calls this method directly on ManageProfileOverlay, |
| 253 // so check the pageDiv to also include its subclasses (in particular | 253 // so check the pageDiv to also include its subclasses (in particular |
| 254 // CreateProfileOverlay, which has higher sub-overlays). | 254 // CreateProfileOverlay, which has higher sub-overlays). |
| 255 if (OptionsPage.getTopmostVisiblePage().pageDiv == this.pageDiv) { | 255 if (PageManager.getTopmostVisiblePage().pageDiv == this.pageDiv) { |
| 256 // This will only have an effect if the 'create-profile-name' element | 256 // This will only have an effect if the 'create-profile-name' element |
| 257 // is visible, i.e. if the overlay is in create mode. | 257 // is visible, i.e. if the overlay is in create mode. |
| 258 $('create-profile-name').focus(); | 258 $('create-profile-name').focus(); |
| 259 } | 259 } |
| 260 $('create-profile-ok').disabled = false; | 260 $('create-profile-ok').disabled = false; |
| 261 }, | 261 }, |
| 262 | 262 |
| 263 /** | 263 /** |
| 264 * Set a dictionary of all profile names. These are used to prevent the | 264 * Set a dictionary of all profile names. These are used to prevent the |
| 265 * user from naming two profiles the same. | 265 * user from naming two profiles the same. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 for (j = i + 1; j < supervisedUsers.length; ++j) { | 369 for (j = i + 1; j < supervisedUsers.length; ++j) { |
| 370 if (supervisedUsers[j].name == newName) { | 370 if (supervisedUsers[j].name == newName) { |
| 371 nameIsUnique = false; | 371 nameIsUnique = false; |
| 372 break; | 372 break; |
| 373 } | 373 } |
| 374 } | 374 } |
| 375 var self = this; | 375 var self = this; |
| 376 function getImportHandler(supervisedUser, nameIsUnique) { | 376 function getImportHandler(supervisedUser, nameIsUnique) { |
| 377 return function() { | 377 return function() { |
| 378 if (supervisedUser.needAvatar || !nameIsUnique) { | 378 if (supervisedUser.needAvatar || !nameIsUnique) { |
| 379 OptionsPage.navigateToPage('supervisedUserImport'); | 379 PageManager.showPageByName('supervisedUserImport'); |
| 380 } else { | 380 } else { |
| 381 self.hideErrorBubble_('create'); | 381 self.hideErrorBubble_('create'); |
| 382 CreateProfileOverlay.updateCreateInProgress(true); | 382 CreateProfileOverlay.updateCreateInProgress(true); |
| 383 chrome.send('createProfile', | 383 chrome.send('createProfile', |
| 384 [supervisedUser.name, supervisedUser.iconURL, false, true, | 384 [supervisedUser.name, supervisedUser.iconURL, false, true, |
| 385 supervisedUser.id]); | 385 supervisedUser.id]); |
| 386 } | 386 } |
| 387 } | 387 } |
| 388 }; | 388 }; |
| 389 $('supervised-user-import-existing').onclick = | 389 $('supervised-user-import-existing').onclick = |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 $('manage-profile-name').disabled = profileInfo.isSupervised; | 512 $('manage-profile-name').disabled = profileInfo.isSupervised; |
| 513 this.hideErrorBubble_('manage'); | 513 this.hideErrorBubble_('manage'); |
| 514 }, | 514 }, |
| 515 | 515 |
| 516 /** | 516 /** |
| 517 * Display the "Manage Profile" dialog. | 517 * Display the "Manage Profile" dialog. |
| 518 * @private | 518 * @private |
| 519 */ | 519 */ |
| 520 showManageDialog_: function() { | 520 showManageDialog_: function() { |
| 521 this.prepareForManageDialog_(); | 521 this.prepareForManageDialog_(); |
| 522 OptionsPage.navigateToPage('manageProfile'); | 522 PageManager.showPageByName('manageProfile'); |
| 523 }, | 523 }, |
| 524 | 524 |
| 525 /** | 525 /** |
| 526 * Display the "Delete Profile" dialog. | 526 * Display the "Delete Profile" dialog. |
| 527 * @param {Object} profileInfo The profile object of the profile to delete. | 527 * @param {Object} profileInfo The profile object of the profile to delete. |
| 528 * @private | 528 * @private |
| 529 */ | 529 */ |
| 530 showDeleteDialog_: function(profileInfo) { | 530 showDeleteDialog_: function(profileInfo) { |
| 531 if (BrowserOptions.getCurrentProfile().isSupervised) | 531 if (BrowserOptions.getCurrentProfile().isSupervised) |
| 532 return; | 532 return; |
| 533 | 533 |
| 534 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); | 534 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); |
| 535 $('manage-profile-overlay-create').hidden = true; | 535 $('manage-profile-overlay-create').hidden = true; |
| 536 $('manage-profile-overlay-manage').hidden = true; | 536 $('manage-profile-overlay-manage').hidden = true; |
| 537 $('manage-profile-overlay-delete').hidden = false; | 537 $('manage-profile-overlay-delete').hidden = false; |
| 538 $('manage-profile-overlay-disconnect-managed').hidden = true; | 538 $('manage-profile-overlay-disconnect-managed').hidden = true; |
| 539 $('delete-profile-icon').style.content = | 539 $('delete-profile-icon').style.content = |
| 540 getProfileAvatarIcon(profileInfo.iconURL); | 540 getProfileAvatarIcon(profileInfo.iconURL); |
| 541 $('delete-profile-text').textContent = | 541 $('delete-profile-text').textContent = |
| 542 loadTimeData.getStringF('deleteProfileMessage', | 542 loadTimeData.getStringF('deleteProfileMessage', |
| 543 elide(profileInfo.name, /* maxLength */ 50)); | 543 elide(profileInfo.name, /* maxLength */ 50)); |
| 544 $('delete-supervised-profile-addendum').hidden = | 544 $('delete-supervised-profile-addendum').hidden = |
| 545 !profileInfo.isSupervised; | 545 !profileInfo.isSupervised; |
| 546 | 546 |
| 547 // Because this dialog isn't useful when refreshing or as part of the | 547 // Because this dialog isn't useful when refreshing or as part of the |
| 548 // history, don't create a history entry for it when showing. | 548 // history, don't create a history entry for it when showing. |
| 549 OptionsPage.showPageByName('manageProfile', false); | 549 PageManager.showPageByName('manageProfile', false); |
| 550 }, | 550 }, |
| 551 | 551 |
| 552 /** | 552 /** |
| 553 * Display the "Disconnect Managed Profile" dialog. | 553 * Display the "Disconnect Managed Profile" dialog. |
| 554 * @private | 554 * @private |
| 555 */ | 555 */ |
| 556 showDisconnectManagedProfileDialog_: function(replacements) { | 556 showDisconnectManagedProfileDialog_: function(replacements) { |
| 557 loadTimeData.overrideValues(replacements); | 557 loadTimeData.overrideValues(replacements); |
| 558 $('manage-profile-overlay-create').hidden = true; | 558 $('manage-profile-overlay-create').hidden = true; |
| 559 $('manage-profile-overlay-manage').hidden = true; | 559 $('manage-profile-overlay-manage').hidden = true; |
| 560 $('manage-profile-overlay-delete').hidden = true; | 560 $('manage-profile-overlay-delete').hidden = true; |
| 561 $('disconnect-managed-profile-domain-information').innerHTML = | 561 $('disconnect-managed-profile-domain-information').innerHTML = |
| 562 loadTimeData.getString('disconnectManagedProfileDomainInformation'); | 562 loadTimeData.getString('disconnectManagedProfileDomainInformation'); |
| 563 $('disconnect-managed-profile-text').innerHTML = | 563 $('disconnect-managed-profile-text').innerHTML = |
| 564 loadTimeData.getString('disconnectManagedProfileText'); | 564 loadTimeData.getString('disconnectManagedProfileText'); |
| 565 $('manage-profile-overlay-disconnect-managed').hidden = false; | 565 $('manage-profile-overlay-disconnect-managed').hidden = false; |
| 566 | 566 |
| 567 // Because this dialog isn't useful when refreshing or as part of the | 567 // Because this dialog isn't useful when refreshing or as part of the |
| 568 // history, don't create a history entry for it when showing. | 568 // history, don't create a history entry for it when showing. |
| 569 OptionsPage.showPageByName('manageProfile', false); | 569 PageManager.showPageByName('manageProfile', false); |
| 570 }, | 570 }, |
| 571 | 571 |
| 572 /** | 572 /** |
| 573 * Display the "Create Profile" dialog. | 573 * Display the "Create Profile" dialog. |
| 574 * @private | 574 * @private |
| 575 */ | 575 */ |
| 576 showCreateDialog_: function() { | 576 showCreateDialog_: function() { |
| 577 OptionsPage.navigateToPage('createProfile'); | 577 PageManager.showPageByName('createProfile'); |
| 578 }, | 578 }, |
| 579 }; | 579 }; |
| 580 | 580 |
| 581 // Forward public APIs to private implementations. | 581 // Forward public APIs to private implementations. |
| 582 [ | 582 [ |
| 583 'receiveDefaultProfileIconsAndNames', | 583 'receiveDefaultProfileIconsAndNames', |
| 584 'receiveNewProfileDefaults', | 584 'receiveNewProfileDefaults', |
| 585 'receiveExistingProfileNames', | 585 'receiveExistingProfileNames', |
| 586 'receiveHasProfileShortcuts', | 586 'receiveHasProfileShortcuts', |
| 587 'setProfileInfo', | 587 'setProfileInfo', |
| 588 'setProfileName', | 588 'setProfileName', |
| 589 'showManageDialog', | 589 'showManageDialog', |
| 590 'showDeleteDialog', | 590 'showDeleteDialog', |
| 591 'showDisconnectManagedProfileDialog', | 591 'showDisconnectManagedProfileDialog', |
| 592 'showCreateDialog', | 592 'showCreateDialog', |
| 593 ].forEach(function(name) { | 593 ].forEach(function(name) { |
| 594 ManageProfileOverlay[name] = function() { | 594 ManageProfileOverlay[name] = function() { |
| 595 var instance = ManageProfileOverlay.getInstance(); | 595 var instance = ManageProfileOverlay.getInstance(); |
| 596 return instance[name + '_'].apply(instance, arguments); | 596 return instance[name + '_'].apply(instance, arguments); |
| 597 }; | 597 }; |
| 598 }); | 598 }); |
| 599 | 599 |
| 600 function CreateProfileOverlay() { | 600 function CreateProfileOverlay() { |
| 601 OptionsPage.call(this, 'createProfile', | 601 Page.call(this, 'createProfile', |
| 602 loadTimeData.getString('createProfileTabTitle'), | 602 loadTimeData.getString('createProfileTabTitle'), |
| 603 'manage-profile-overlay'); | 603 'manage-profile-overlay'); |
| 604 }; | 604 }; |
| 605 | 605 |
| 606 cr.addSingletonGetter(CreateProfileOverlay); | 606 cr.addSingletonGetter(CreateProfileOverlay); |
| 607 | 607 |
| 608 CreateProfileOverlay.prototype = { | 608 CreateProfileOverlay.prototype = { |
| 609 // Inherit from ManageProfileOverlay. | 609 // Inherit from ManageProfileOverlay. |
| 610 __proto__: ManageProfileOverlay.prototype, | 610 __proto__: ManageProfileOverlay.prototype, |
| 611 | 611 |
| 612 // The signed-in email address of the current profile, or empty if they're | 612 // The signed-in email address of the current profile, or empty if they're |
| 613 // not signed in. | 613 // not signed in. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 | 693 |
| 694 $('create-profile-throbber').hidden = !inProgress; | 694 $('create-profile-throbber').hidden = !inProgress; |
| 695 }, | 695 }, |
| 696 | 696 |
| 697 /** | 697 /** |
| 698 * Cancels the creation of the a profile. It is safe to call this even | 698 * Cancels the creation of the a profile. It is safe to call this even |
| 699 * when no profile is in the process of being created. | 699 * when no profile is in the process of being created. |
| 700 * @private | 700 * @private |
| 701 */ | 701 */ |
| 702 cancelCreateProfile_: function() { | 702 cancelCreateProfile_: function() { |
| 703 OptionsPage.closeOverlay(); | 703 PageManager.closeOverlay(); |
| 704 chrome.send('cancelCreateProfile'); | 704 chrome.send('cancelCreateProfile'); |
| 705 this.hideErrorBubble_(); | 705 this.hideErrorBubble_(); |
| 706 this.updateCreateInProgress_(false); | 706 this.updateCreateInProgress_(false); |
| 707 }, | 707 }, |
| 708 | 708 |
| 709 /** | 709 /** |
| 710 * Shows an error message describing an error that occurred while creating | 710 * Shows an error message describing an error that occurred while creating |
| 711 * a new profile. | 711 * a new profile. |
| 712 * Called by BrowserOptions via the BrowserOptionsHandler. | 712 * Called by BrowserOptions via the BrowserOptionsHandler. |
| 713 * @param {string} error The error message to display. | 713 * @param {string} error The error message to display. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 734 * @param {Object} profileInfo An object of the form: | 734 * @param {Object} profileInfo An object of the form: |
| 735 * profileInfo = { | 735 * profileInfo = { |
| 736 * name: "Profile Name", | 736 * name: "Profile Name", |
| 737 * filePath: "/path/to/profile/data/on/disk" | 737 * filePath: "/path/to/profile/data/on/disk" |
| 738 * isSupervised: (true|false), | 738 * isSupervised: (true|false), |
| 739 * }; | 739 * }; |
| 740 * @private | 740 * @private |
| 741 */ | 741 */ |
| 742 onSuccess_: function(profileInfo) { | 742 onSuccess_: function(profileInfo) { |
| 743 this.updateCreateInProgress_(false); | 743 this.updateCreateInProgress_(false); |
| 744 OptionsPage.closeOverlay(); | 744 PageManager.closeOverlay(); |
| 745 if (profileInfo.isSupervised) { | 745 if (profileInfo.isSupervised) { |
| 746 options.SupervisedUserListData.resetPromise(); | 746 options.SupervisedUserListData.resetPromise(); |
| 747 profileInfo.custodianEmail = this.signedInEmail_; | 747 profileInfo.custodianEmail = this.signedInEmail_; |
| 748 SupervisedUserCreateConfirmOverlay.setProfileInfo(profileInfo); | 748 SupervisedUserCreateConfirmOverlay.setProfileInfo(profileInfo); |
| 749 OptionsPage.showPageByName('supervisedUserCreateConfirm', false); | 749 PageManager.showPageByName('supervisedUserCreateConfirm', false); |
| 750 BrowserOptions.updateManagesSupervisedUsers(true); | 750 BrowserOptions.updateManagesSupervisedUsers(true); |
| 751 } | 751 } |
| 752 }, | 752 }, |
| 753 | 753 |
| 754 /** | 754 /** |
| 755 * Updates the signed-in or not-signed-in UI when in create mode. Called by | 755 * Updates the signed-in or not-signed-in UI when in create mode. Called by |
| 756 * the handler in response to the 'requestCreateProfileUpdate' message. | 756 * the handler in response to the 'requestCreateProfileUpdate' message. |
| 757 * updateSupervisedUsersAllowed_ is expected to be called after this is, and | 757 * updateSupervisedUsersAllowed_ is expected to be called after this is, and |
| 758 * will update additional UI elements. | 758 * will update additional UI elements. |
| 759 * @param {string} email The email address of the currently signed-in user. | 759 * @param {string} email The email address of the currently signed-in user. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 858 return instance[name + '_'].apply(instance, arguments); | 858 return instance[name + '_'].apply(instance, arguments); |
| 859 }; | 859 }; |
| 860 }); | 860 }); |
| 861 | 861 |
| 862 // Export | 862 // Export |
| 863 return { | 863 return { |
| 864 ManageProfileOverlay: ManageProfileOverlay, | 864 ManageProfileOverlay: ManageProfileOverlay, |
| 865 CreateProfileOverlay: CreateProfileOverlay, | 865 CreateProfileOverlay: CreateProfileOverlay, |
| 866 }; | 866 }; |
| 867 }); | 867 }); |
| OLD | NEW |