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 /** | 45 /** |
45 * Initialize the page. | 46 * Initialize the page. |
46 */ | 47 */ |
47 initializePage: function() { | 48 initializePage: function() { |
48 // Call base class implementation to start preference initialization. | 49 Page.prototype.initializePage.call(this); |
49 OptionsPage.prototype.initializePage.call(this); | |
50 | 50 |
51 var self = this; | 51 var self = this; |
52 options.ProfilesIconGrid.decorate($('manage-profile-icon-grid')); | 52 options.ProfilesIconGrid.decorate($('manage-profile-icon-grid')); |
53 options.ProfilesIconGrid.decorate($('create-profile-icon-grid')); | 53 options.ProfilesIconGrid.decorate($('create-profile-icon-grid')); |
54 self.registerCommonEventHandlers_('create', | 54 self.registerCommonEventHandlers_('create', |
55 self.submitCreateProfile_.bind(self)); | 55 self.submitCreateProfile_.bind(self)); |
56 self.registerCommonEventHandlers_('manage', | 56 self.registerCommonEventHandlers_('manage', |
57 self.submitManageChanges_.bind(self)); | 57 self.submitManageChanges_.bind(self)); |
58 | 58 |
59 // Override the create-profile-ok and create-* keydown handlers, to avoid | 59 // Override the create-profile-ok and create-* keydown handlers, to avoid |
60 // closing the overlay until we finish creating the profile. | 60 // closing the overlay until we finish creating the profile. |
61 $('create-profile-ok').onclick = function(event) { | 61 $('create-profile-ok').onclick = function(event) { |
62 self.submitCreateProfile_(); | 62 self.submitCreateProfile_(); |
63 }; | 63 }; |
64 | 64 |
65 $('create-profile-cancel').onclick = function(event) { | 65 $('create-profile-cancel').onclick = function(event) { |
66 CreateProfileOverlay.cancelCreateProfile(); | 66 CreateProfileOverlay.cancelCreateProfile(); |
67 }; | 67 }; |
68 | 68 |
69 $('manage-profile-cancel').onclick = | 69 $('manage-profile-cancel').onclick = |
70 $('disconnect-managed-profile-cancel').onclick = | 70 $('disconnect-managed-profile-cancel').onclick = |
71 $('delete-profile-cancel').onclick = function(event) { | 71 $('delete-profile-cancel').onclick = function(event) { |
72 OptionsPage.closeOverlay(); | 72 PageManager.closeOverlay(); |
73 }; | 73 }; |
74 $('delete-profile-ok').onclick = function(event) { | 74 $('delete-profile-ok').onclick = function(event) { |
75 OptionsPage.closeOverlay(); | 75 PageManager.closeOverlay(); |
76 if (BrowserOptions.getCurrentProfile().isManaged) | 76 if (BrowserOptions.getCurrentProfile().isManaged) |
77 return; | 77 return; |
78 chrome.send('deleteProfile', [self.profileInfo_.filePath]); | 78 chrome.send('deleteProfile', [self.profileInfo_.filePath]); |
79 options.ManagedUserListData.resetPromise(); | 79 options.ManagedUserListData.resetPromise(); |
80 }; | 80 }; |
81 $('add-shortcut-button').onclick = function(event) { | 81 $('add-shortcut-button').onclick = function(event) { |
82 chrome.send('addProfileShortcut', [self.profileInfo_.filePath]); | 82 chrome.send('addProfileShortcut', [self.profileInfo_.filePath]); |
83 }; | 83 }; |
84 $('remove-shortcut-button').onclick = function(event) { | 84 $('remove-shortcut-button').onclick = function(event) { |
85 chrome.send('removeProfileShortcut', [self.profileInfo_.filePath]); | 85 chrome.send('removeProfileShortcut', [self.profileInfo_.filePath]); |
86 }; | 86 }; |
87 | 87 |
88 $('disconnect-managed-profile-ok').onclick = function(event) { | 88 $('disconnect-managed-profile-ok').onclick = function(event) { |
89 OptionsPage.closeOverlay(); | 89 PageManager.closeOverlay(); |
90 chrome.send('deleteProfile', | 90 chrome.send('deleteProfile', |
91 [BrowserOptions.getCurrentProfile().filePath]); | 91 [BrowserOptions.getCurrentProfile().filePath]); |
92 } | 92 } |
93 | 93 |
94 $('create-profile-managed-signed-in-learn-more-link').onclick = | 94 $('create-profile-managed-signed-in-learn-more-link').onclick = |
95 function(event) { | 95 function(event) { |
96 OptionsPage.navigateToPage('managedUserLearnMore'); | 96 PageManager.navigateToPage('managedUserLearnMore'); |
97 return false; | 97 return false; |
98 }; | 98 }; |
99 | 99 |
100 $('create-profile-managed-not-signed-in-link').onclick = function(event) { | 100 $('create-profile-managed-not-signed-in-link').onclick = function(event) { |
101 // The signin process will open an overlay to configure sync, which | 101 // The signin process will open an overlay to configure sync, which |
102 // would replace this overlay. It's smoother to close this one now. | 102 // would replace this overlay. It's smoother to close this one now. |
103 // TODO(pamg): Move the sync-setup overlay to a higher layer so this one | 103 // TODO(pamg): Move the sync-setup overlay to a higher layer so this one |
104 // can stay open under it, after making sure that doesn't break anything | 104 // can stay open under it, after making sure that doesn't break anything |
105 // else. | 105 // else. |
106 OptionsPage.closeOverlay(); | 106 PageManager.closeOverlay(); |
107 SyncSetupOverlay.startSignIn(); | 107 SyncSetupOverlay.startSignIn(); |
108 }; | 108 }; |
109 | 109 |
110 $('create-profile-managed-sign-in-again-link').onclick = function(event) { | 110 $('create-profile-managed-sign-in-again-link').onclick = function(event) { |
111 OptionsPage.closeOverlay(); | 111 PageManager.closeOverlay(); |
112 SyncSetupOverlay.showSetupUI(); | 112 SyncSetupOverlay.showSetupUI(); |
113 }; | 113 }; |
114 | 114 |
115 $('import-existing-managed-user-link').onclick = function(event) { | 115 $('import-existing-managed-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-managed-user-link').hidden = true; | 119 $('import-existing-managed-user-link').hidden = true; |
120 OptionsPage.navigateToPage('managedUserImport'); | 120 PageManager.navigateToPage('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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 for (j = i + 1; j < managedUsers.length; ++j) { | 368 for (j = i + 1; j < managedUsers.length; ++j) { |
369 if (managedUsers[j].name == newName) { | 369 if (managedUsers[j].name == newName) { |
370 nameIsUnique = false; | 370 nameIsUnique = false; |
371 break; | 371 break; |
372 } | 372 } |
373 } | 373 } |
374 var self = this; | 374 var self = this; |
375 function getImportHandler(managedUser, nameIsUnique) { | 375 function getImportHandler(managedUser, nameIsUnique) { |
376 return function() { | 376 return function() { |
377 if (managedUser.needAvatar || !nameIsUnique) { | 377 if (managedUser.needAvatar || !nameIsUnique) { |
378 OptionsPage.navigateToPage('managedUserImport'); | 378 PageManager.navigateToPage('managedUserImport'); |
379 } else { | 379 } else { |
380 self.hideErrorBubble_('create'); | 380 self.hideErrorBubble_('create'); |
381 CreateProfileOverlay.updateCreateInProgress(true); | 381 CreateProfileOverlay.updateCreateInProgress(true); |
382 chrome.send('createProfile', | 382 chrome.send('createProfile', |
383 [managedUser.name, managedUser.iconURL, false, true, | 383 [managedUser.name, managedUser.iconURL, false, true, |
384 managedUser.id]); | 384 managedUser.id]); |
385 } | 385 } |
386 } | 386 } |
387 }; | 387 }; |
388 $('supervised-user-import').onclick = | 388 $('supervised-user-import').onclick = |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 $('manage-profile-name').disabled = profileInfo.isManaged; | 511 $('manage-profile-name').disabled = profileInfo.isManaged; |
512 this.hideErrorBubble_('manage'); | 512 this.hideErrorBubble_('manage'); |
513 }, | 513 }, |
514 | 514 |
515 /** | 515 /** |
516 * Display the "Manage Profile" dialog. | 516 * Display the "Manage Profile" dialog. |
517 * @private | 517 * @private |
518 */ | 518 */ |
519 showManageDialog_: function() { | 519 showManageDialog_: function() { |
520 this.prepareForManageDialog_(); | 520 this.prepareForManageDialog_(); |
521 OptionsPage.navigateToPage('manageProfile'); | 521 PageManager.navigateToPage('manageProfile'); |
522 }, | 522 }, |
523 | 523 |
524 /** | 524 /** |
525 * Display the "Delete Profile" dialog. | 525 * Display the "Delete Profile" dialog. |
526 * @param {Object} profileInfo The profile object of the profile to delete. | 526 * @param {Object} profileInfo The profile object of the profile to delete. |
527 * @private | 527 * @private |
528 */ | 528 */ |
529 showDeleteDialog_: function(profileInfo) { | 529 showDeleteDialog_: function(profileInfo) { |
530 if (BrowserOptions.getCurrentProfile().isManaged) | 530 if (BrowserOptions.getCurrentProfile().isManaged) |
531 return; | 531 return; |
532 | 532 |
533 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); | 533 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); |
534 $('manage-profile-overlay-create').hidden = true; | 534 $('manage-profile-overlay-create').hidden = true; |
535 $('manage-profile-overlay-manage').hidden = true; | 535 $('manage-profile-overlay-manage').hidden = true; |
536 $('manage-profile-overlay-delete').hidden = false; | 536 $('manage-profile-overlay-delete').hidden = false; |
537 $('manage-profile-overlay-disconnect-managed').hidden = true; | 537 $('manage-profile-overlay-disconnect-managed').hidden = true; |
538 $('delete-profile-icon').style.content = | 538 $('delete-profile-icon').style.content = |
539 getProfileAvatarIcon(profileInfo.iconURL); | 539 getProfileAvatarIcon(profileInfo.iconURL); |
540 $('delete-profile-text').textContent = | 540 $('delete-profile-text').textContent = |
541 loadTimeData.getStringF('deleteProfileMessage', | 541 loadTimeData.getStringF('deleteProfileMessage', |
542 elide(profileInfo.name, /* maxLength */ 50)); | 542 elide(profileInfo.name, /* maxLength */ 50)); |
543 $('delete-managed-profile-addendum').hidden = !profileInfo.isManaged; | 543 $('delete-managed-profile-addendum').hidden = !profileInfo.isManaged; |
544 | 544 |
545 // Because this dialog isn't useful when refreshing or as part of the | 545 // Because this dialog isn't useful when refreshing or as part of the |
546 // history, don't create a history entry for it when showing. | 546 // history, don't create a history entry for it when showing. |
547 OptionsPage.showPageByName('manageProfile', false); | 547 PageManager.showPageByName('manageProfile', false); |
548 }, | 548 }, |
549 | 549 |
550 /** | 550 /** |
551 * Display the "Disconnect Managed Profile" dialog. | 551 * Display the "Disconnect Managed Profile" dialog. |
552 * @private | 552 * @private |
553 */ | 553 */ |
554 showDisconnectManagedProfileDialog_: function(replacements) { | 554 showDisconnectManagedProfileDialog_: function(replacements) { |
555 loadTimeData.overrideValues(replacements); | 555 loadTimeData.overrideValues(replacements); |
556 $('manage-profile-overlay-create').hidden = true; | 556 $('manage-profile-overlay-create').hidden = true; |
557 $('manage-profile-overlay-manage').hidden = true; | 557 $('manage-profile-overlay-manage').hidden = true; |
558 $('manage-profile-overlay-delete').hidden = true; | 558 $('manage-profile-overlay-delete').hidden = true; |
559 $('disconnect-managed-profile-domain-information').innerHTML = | 559 $('disconnect-managed-profile-domain-information').innerHTML = |
560 loadTimeData.getString('disconnectManagedProfileDomainInformation'); | 560 loadTimeData.getString('disconnectManagedProfileDomainInformation'); |
561 $('disconnect-managed-profile-text').innerHTML = | 561 $('disconnect-managed-profile-text').innerHTML = |
562 loadTimeData.getString('disconnectManagedProfileText'); | 562 loadTimeData.getString('disconnectManagedProfileText'); |
563 $('manage-profile-overlay-disconnect-managed').hidden = false; | 563 $('manage-profile-overlay-disconnect-managed').hidden = false; |
564 | 564 |
565 // Because this dialog isn't useful when refreshing or as part of the | 565 // Because this dialog isn't useful when refreshing or as part of the |
566 // history, don't create a history entry for it when showing. | 566 // history, don't create a history entry for it when showing. |
567 OptionsPage.showPageByName('manageProfile', false); | 567 PageManager.showPageByName('manageProfile', false); |
568 }, | 568 }, |
569 | 569 |
570 /** | 570 /** |
571 * Display the "Create Profile" dialog. | 571 * Display the "Create Profile" dialog. |
572 * @private | 572 * @private |
573 */ | 573 */ |
574 showCreateDialog_: function() { | 574 showCreateDialog_: function() { |
575 OptionsPage.navigateToPage('createProfile'); | 575 PageManager.navigateToPage('createProfile'); |
576 }, | 576 }, |
577 }; | 577 }; |
578 | 578 |
579 // Forward public APIs to private implementations. | 579 // Forward public APIs to private implementations. |
580 [ | 580 [ |
581 'receiveDefaultProfileIconsAndNames', | 581 'receiveDefaultProfileIconsAndNames', |
582 'receiveNewProfileDefaults', | 582 'receiveNewProfileDefaults', |
583 'receiveExistingProfileNames', | 583 'receiveExistingProfileNames', |
584 'receiveHasProfileShortcuts', | 584 'receiveHasProfileShortcuts', |
585 'setProfileInfo', | 585 'setProfileInfo', |
586 'setProfileName', | 586 'setProfileName', |
587 'showManageDialog', | 587 'showManageDialog', |
588 'showDeleteDialog', | 588 'showDeleteDialog', |
589 'showDisconnectManagedProfileDialog', | 589 'showDisconnectManagedProfileDialog', |
590 'showCreateDialog', | 590 'showCreateDialog', |
591 ].forEach(function(name) { | 591 ].forEach(function(name) { |
592 ManageProfileOverlay[name] = function() { | 592 ManageProfileOverlay[name] = function() { |
593 var instance = ManageProfileOverlay.getInstance(); | 593 var instance = ManageProfileOverlay.getInstance(); |
594 return instance[name + '_'].apply(instance, arguments); | 594 return instance[name + '_'].apply(instance, arguments); |
595 }; | 595 }; |
596 }); | 596 }); |
597 | 597 |
598 function CreateProfileOverlay() { | 598 function CreateProfileOverlay() { |
599 OptionsPage.call(this, 'createProfile', | 599 Page.call(this, 'createProfile', |
600 loadTimeData.getString('createProfileTabTitle'), | 600 loadTimeData.getString('createProfileTabTitle'), |
601 'manage-profile-overlay'); | 601 'manage-profile-overlay'); |
602 }; | 602 }; |
603 | 603 |
604 cr.addSingletonGetter(CreateProfileOverlay); | 604 cr.addSingletonGetter(CreateProfileOverlay); |
605 | 605 |
606 CreateProfileOverlay.prototype = { | 606 CreateProfileOverlay.prototype = { |
607 // Inherit from ManageProfileOverlay. | 607 // Inherit from ManageProfileOverlay. |
608 __proto__: ManageProfileOverlay.prototype, | 608 __proto__: ManageProfileOverlay.prototype, |
609 | 609 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
691 | 691 |
692 $('create-profile-throbber').hidden = !inProgress; | 692 $('create-profile-throbber').hidden = !inProgress; |
693 }, | 693 }, |
694 | 694 |
695 /** | 695 /** |
696 * Cancels the creation of the a profile. It is safe to call this even | 696 * Cancels the creation of the a profile. It is safe to call this even |
697 * when no profile is in the process of being created. | 697 * when no profile is in the process of being created. |
698 * @private | 698 * @private |
699 */ | 699 */ |
700 cancelCreateProfile_: function() { | 700 cancelCreateProfile_: function() { |
701 OptionsPage.closeOverlay(); | 701 PageManager.closeOverlay(); |
702 chrome.send('cancelCreateProfile'); | 702 chrome.send('cancelCreateProfile'); |
703 this.hideErrorBubble_(); | 703 this.hideErrorBubble_(); |
704 this.updateCreateInProgress_(false); | 704 this.updateCreateInProgress_(false); |
705 }, | 705 }, |
706 | 706 |
707 /** | 707 /** |
708 * Shows an error message describing an error that occurred while creating | 708 * Shows an error message describing an error that occurred while creating |
709 * a new profile. | 709 * a new profile. |
710 * Called by BrowserOptions via the BrowserOptionsHandler. | 710 * Called by BrowserOptions via the BrowserOptionsHandler. |
711 * @param {string} error The error message to display. | 711 * @param {string} error The error message to display. |
(...skipping 20 matching lines...) Expand all Loading... |
732 * @param {Object} profileInfo An object of the form: | 732 * @param {Object} profileInfo An object of the form: |
733 * profileInfo = { | 733 * profileInfo = { |
734 * name: "Profile Name", | 734 * name: "Profile Name", |
735 * filePath: "/path/to/profile/data/on/disk" | 735 * filePath: "/path/to/profile/data/on/disk" |
736 * isManaged: (true|false), | 736 * isManaged: (true|false), |
737 * }; | 737 * }; |
738 * @private | 738 * @private |
739 */ | 739 */ |
740 onSuccess_: function(profileInfo) { | 740 onSuccess_: function(profileInfo) { |
741 this.updateCreateInProgress_(false); | 741 this.updateCreateInProgress_(false); |
742 OptionsPage.closeOverlay(); | 742 PageManager.closeOverlay(); |
743 if (profileInfo.isManaged) { | 743 if (profileInfo.isManaged) { |
744 options.ManagedUserListData.resetPromise(); | 744 options.ManagedUserListData.resetPromise(); |
745 profileInfo.custodianEmail = this.signedInEmail_; | 745 profileInfo.custodianEmail = this.signedInEmail_; |
746 ManagedUserCreateConfirmOverlay.setProfileInfo(profileInfo); | 746 ManagedUserCreateConfirmOverlay.setProfileInfo(profileInfo); |
747 OptionsPage.showPageByName('managedUserCreateConfirm', false); | 747 PageManager.showPageByName('managedUserCreateConfirm', false); |
748 BrowserOptions.updateManagesSupervisedUsers(true); | 748 BrowserOptions.updateManagesSupervisedUsers(true); |
749 } | 749 } |
750 }, | 750 }, |
751 | 751 |
752 /** | 752 /** |
753 * Updates the signed-in or not-signed-in UI when in create mode. Called by | 753 * Updates the signed-in or not-signed-in UI when in create mode. Called by |
754 * the handler in response to the 'requestCreateProfileUpdate' message. | 754 * the handler in response to the 'requestCreateProfileUpdate' message. |
755 * updateManagedUsersAllowed_ is expected to be called after this is, and | 755 * updateManagedUsersAllowed_ is expected to be called after this is, and |
756 * will update additional UI elements. | 756 * will update additional UI elements. |
757 * @param {string} email The email address of the currently signed-in user. | 757 * @param {string} email The email address of the currently signed-in user. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 return instance[name + '_'].apply(instance, arguments); | 853 return instance[name + '_'].apply(instance, arguments); |
854 }; | 854 }; |
855 }); | 855 }); |
856 | 856 |
857 // Export | 857 // Export |
858 return { | 858 return { |
859 ManageProfileOverlay: ManageProfileOverlay, | 859 ManageProfileOverlay: ManageProfileOverlay, |
860 CreateProfileOverlay: CreateProfileOverlay, | 860 CreateProfileOverlay: CreateProfileOverlay, |
861 }; | 861 }; |
862 }); | 862 }); |
OLD | NEW |