Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(501)

Side by Side Diff: chrome/browser/resources/options/manage_profile_overlay.js

Issue 403343002: Rename "managed (mode|user)" to "supervised user" (part 8) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix2 Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 OptionsPage.closeOverlay();
73 }; 73 };
74 $('delete-profile-ok').onclick = function(event) { 74 $('delete-profile-ok').onclick = function(event) {
75 OptionsPage.closeOverlay(); 75 OptionsPage.closeOverlay();
76 if (BrowserOptions.getCurrentProfile().isManaged) 76 if (BrowserOptions.getCurrentProfile().isSupervised)
77 return; 77 return;
78 chrome.send('deleteProfile', [self.profileInfo_.filePath]); 78 chrome.send('deleteProfile', [self.profileInfo_.filePath]);
79 options.ManagedUserListData.resetPromise(); 79 options.SupervisedUserListData.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 OptionsPage.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-supervised-signed-in-learn-more-link').onclick =
95 function(event) { 95 function(event) {
96 OptionsPage.navigateToPage('managedUserLearnMore'); 96 OptionsPage.navigateToPage('supervisedUserLearnMore');
97 return false; 97 return false;
98 }; 98 };
99 99
100 $('create-profile-managed-not-signed-in-link').onclick = function(event) { 100 $('create-profile-supervised-not-signed-in-link').onclick =
101 function(event) {
101 // The signin process will open an overlay to configure sync, which 102 // The signin process will open an overlay to configure sync, which
102 // would replace this overlay. It's smoother to close this one now. 103 // 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 104 // 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 105 // can stay open under it, after making sure that doesn't break anything
105 // else. 106 // else.
106 OptionsPage.closeOverlay(); 107 OptionsPage.closeOverlay();
107 SyncSetupOverlay.startSignIn(); 108 SyncSetupOverlay.startSignIn();
108 }; 109 };
109 110
110 $('create-profile-managed-sign-in-again-link').onclick = function(event) { 111 $('create-profile-supervised-sign-in-again-link').onclick =
112 function(event) {
111 OptionsPage.closeOverlay(); 113 OptionsPage.closeOverlay();
112 SyncSetupOverlay.showSetupUI(); 114 SyncSetupOverlay.showSetupUI();
113 }; 115 };
114 116
115 $('import-existing-managed-user-link').onclick = function(event) { 117 $('import-existing-supervised-user-link').onclick = function(event) {
116 // Hide the import button to trigger a cursor update. The import button 118 // Hide the import button to trigger a cursor update. The import button
117 // is shown again when the import overlay loads. TODO(akuegel): Remove 119 // is shown again when the import overlay loads. TODO(akuegel): Remove
118 // this temporary fix when crbug/246304 is resolved. 120 // this temporary fix when crbug/246304 is resolved.
119 $('import-existing-managed-user-link').hidden = true; 121 $('import-existing-supervised-user-link').hidden = true;
120 OptionsPage.navigateToPage('managedUserImport'); 122 OptionsPage.navigateToPage('supervisedUserImport');
121 }; 123 };
122 }, 124 },
123 125
124 /** @override */ 126 /** @override */
125 didShowPage: function() { 127 didShowPage: function() {
126 chrome.send('requestDefaultProfileIcons', ['manage']); 128 chrome.send('requestDefaultProfileIcons', ['manage']);
127 129
128 // Just ignore the manage profile dialog on Chrome OS, they use /accounts. 130 // Just ignore the manage profile dialog on Chrome OS, they use /accounts.
129 if (!cr.isChromeOS && window.location.pathname == '/manageProfile') 131 if (!cr.isChromeOS && window.location.pathname == '/manageProfile')
130 ManageProfileOverlay.getInstance().prepareForManageDialog_(); 132 ManageProfileOverlay.getInstance().prepareForManageDialog_();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 }, 175 },
174 176
175 /** 177 /**
176 * Set the profile info used in the dialog. 178 * Set the profile info used in the dialog.
177 * @param {Object} profileInfo An object of the form: 179 * @param {Object} profileInfo An object of the form:
178 * profileInfo = { 180 * profileInfo = {
179 * name: "Profile Name", 181 * name: "Profile Name",
180 * iconURL: "chrome://path/to/icon/image", 182 * iconURL: "chrome://path/to/icon/image",
181 * filePath: "/path/to/profile/data/on/disk", 183 * filePath: "/path/to/profile/data/on/disk",
182 * isCurrentProfile: false, 184 * isCurrentProfile: false,
183 * isManaged: false 185 * isSupervised: false
184 * }; 186 * };
185 * @param {string} mode A label that specifies the type of dialog box which 187 * @param {string} mode A label that specifies the type of dialog box which
186 * is currently being viewed (i.e. 'create' or 'manage'). 188 * is currently being viewed (i.e. 'create' or 'manage').
187 * @private 189 * @private
188 */ 190 */
189 setProfileInfo_: function(profileInfo, mode) { 191 setProfileInfo_: function(profileInfo, mode) {
190 this.iconGridSelectedURL_ = profileInfo.iconURL; 192 this.iconGridSelectedURL_ = profileInfo.iconURL;
191 this.profileInfo_ = profileInfo; 193 this.profileInfo_ = profileInfo;
192 $(mode + '-profile-name').value = profileInfo.name; 194 $(mode + '-profile-name').value = profileInfo.name;
193 $(mode + '-profile-icon-grid').selectedItem = profileInfo.iconURL; 195 $(mode + '-profile-icon-grid').selectedItem = profileInfo.iconURL;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 * @param {string} mode A label that specifies the type of dialog box which 320 * @param {string} mode A label that specifies the type of dialog box which
319 * is currently being viewed (i.e. 'create' or 'manage'). 321 * is currently being viewed (i.e. 'create' or 'manage').
320 * @private 322 * @private
321 */ 323 */
322 onNameChanged_: function(mode) { 324 onNameChanged_: function(mode) {
323 this.profileNameIsDefault_ = false; 325 this.profileNameIsDefault_ = false;
324 this.updateCreateOrImport_(mode); 326 this.updateCreateOrImport_(mode);
325 }, 327 },
326 328
327 /** 329 /**
328 * Called when the profile name is changed or the 'create managed' checkbox 330 * Called when the profile name is changed or the 'create supervised'
329 * is toggled. Updates the 'ok' button and the 'import existing supervised 331 * checkbox is toggled. Updates the 'ok' button and the 'import existing
330 * user' link. 332 * supervised user' link.
331 * @param {string} mode A label that specifies the type of dialog box which 333 * @param {string} mode A label that specifies the type of dialog box which
332 * is currently being viewed (i.e. 'create' or 'manage'). 334 * is currently being viewed (i.e. 'create' or 'manage').
333 * @private 335 * @private
334 */ 336 */
335 updateCreateOrImport_: function(mode) { 337 updateCreateOrImport_: function(mode) {
336 // In 'create' mode, check for existing managed users with the same name. 338 // In 'create' mode, check for existing supervised users with the same
337 if (mode == 'create' && $('create-profile-managed').checked) { 339 // name.
338 options.ManagedUserListData.requestExistingManagedUsers().then( 340 if (mode == 'create' && $('create-profile-supervised').checked) {
339 this.receiveExistingManagedUsers_.bind(this), 341 options.SupervisedUserListData.requestExistingSupervisedUsers().then(
342 this.receiveExistingSupervisedUsers_.bind(this),
340 this.onSigninError_.bind(this)); 343 this.onSigninError_.bind(this));
341 } else { 344 } else {
342 this.updateOkButton_(mode); 345 this.updateOkButton_(mode);
343 } 346 }
344 }, 347 },
345 348
346 /** 349 /**
347 * Callback which receives the list of existing managed users. Checks if the 350 * Callback which receives the list of existing supervised users. Checks if
348 * currently entered name is the name of an already existing managed user. 351 * the currently entered name is the name of an already existing supervised
349 * If yes, the user is prompted to import the existing managed user, and the 352 * user. If yes, the user is prompted to import the existing supervised
350 * create button is disabled. 353 * user, and the create button is disabled.
351 * @param {Array.<Object>} The list of existing managed users. 354 * @param {Array.<Object>} The list of existing supervised users.
352 * @private 355 * @private
353 */ 356 */
354 receiveExistingManagedUsers_: function(managedUsers) { 357 receiveExistingSupervisedUsers_: function(supervisedUsers) {
355 var newName = $('create-profile-name').value; 358 var newName = $('create-profile-name').value;
356 var i; 359 var i;
357 for (i = 0; i < managedUsers.length; ++i) { 360 for (i = 0; i < supervisedUsers.length; ++i) {
358 if (managedUsers[i].name == newName && 361 if (supervisedUsers[i].name == newName &&
359 !managedUsers[i].onCurrentDevice) { 362 !supervisedUsers[i].onCurrentDevice) {
360 var errorHtml = loadTimeData.getStringF( 363 var errorHtml = loadTimeData.getStringF(
361 'manageProfilesExistingSupervisedUser', 364 'manageProfilesExistingSupervisedUser',
362 HTMLEscape(elide(newName, /* maxLength */ 50))); 365 HTMLEscape(elide(newName, /* maxLength */ 50)));
363 this.showErrorBubble_(errorHtml, 'create', true); 366 this.showErrorBubble_(errorHtml, 'create', true);
364 367
365 // Check if another supervised user also exists with that name. 368 // Check if another supervised user also exists with that name.
366 var nameIsUnique = true; 369 var nameIsUnique = true;
367 var j; 370 var j;
368 for (j = i + 1; j < managedUsers.length; ++j) { 371 for (j = i + 1; j < supervisedUsers.length; ++j) {
369 if (managedUsers[j].name == newName) { 372 if (supervisedUsers[j].name == newName) {
370 nameIsUnique = false; 373 nameIsUnique = false;
371 break; 374 break;
372 } 375 }
373 } 376 }
374 var self = this; 377 var self = this;
375 function getImportHandler(managedUser, nameIsUnique) { 378 function getImportHandler(supervisedUser, nameIsUnique) {
376 return function() { 379 return function() {
377 if (managedUser.needAvatar || !nameIsUnique) { 380 if (supervisedUser.needAvatar || !nameIsUnique) {
378 OptionsPage.navigateToPage('managedUserImport'); 381 OptionsPage.navigateToPage('supervisedUserImport');
379 } else { 382 } else {
380 self.hideErrorBubble_('create'); 383 self.hideErrorBubble_('create');
381 CreateProfileOverlay.updateCreateInProgress(true); 384 CreateProfileOverlay.updateCreateInProgress(true);
382 chrome.send('createProfile', 385 chrome.send('createProfile',
383 [managedUser.name, managedUser.iconURL, false, true, 386 [supervisedUser.name, supervisedUser.iconURL, false, true,
384 managedUser.id]); 387 supervisedUser.id]);
385 } 388 }
386 } 389 }
387 }; 390 };
388 $('supervised-user-import').onclick = 391 $('supervised-user-import-existing').onclick =
389 getImportHandler(managedUsers[i], nameIsUnique); 392 getImportHandler(supervisedUsers[i], nameIsUnique);
390 $('create-profile-ok').disabled = true; 393 $('create-profile-ok').disabled = true;
391 return; 394 return;
392 } 395 }
393 } 396 }
394 this.updateOkButton_('create'); 397 this.updateOkButton_('create');
395 }, 398 },
396 399
397 /** 400 /**
398 * Called in case the request for the list of managed users fails because of 401 * Called in case the request for the list of supervised users fails because
399 * a signin error. 402 * of a signin error.
400 * @private 403 * @private
401 */ 404 */
402 onSigninError_: function() { 405 onSigninError_: function() {
403 this.updateImportExistingManagedUserLink_(false); 406 this.updateImportExistingSupervisedUserLink_(false);
404 }, 407 },
405 408
406 /** 409 /**
407 * Called to update the state of the ok button depending if the name is 410 * Called to update the state of the ok button depending if the name is
408 * already used or not. 411 * already used or not.
409 * @param {string} mode A label that specifies the type of dialog box which 412 * @param {string} mode A label that specifies the type of dialog box which
410 * is currently being viewed (i.e. 'create' or 'manage'). 413 * is currently being viewed (i.e. 'create' or 'manage').
411 * @private 414 * @private
412 */ 415 */
413 updateOkButton_: function(mode) { 416 updateOkButton_: function(mode) {
(...skipping 19 matching lines...) Expand all
433 * profile info. 436 * profile info.
434 * @private 437 * @private
435 */ 438 */
436 submitManageChanges_: function() { 439 submitManageChanges_: function() {
437 var name = $('manage-profile-name').value; 440 var name = $('manage-profile-name').value;
438 var iconURL = $('manage-profile-icon-grid').selectedItem; 441 var iconURL = $('manage-profile-icon-grid').selectedItem;
439 442
440 chrome.send('setProfileIconAndName', 443 chrome.send('setProfileIconAndName',
441 [this.profileInfo_.filePath, iconURL, name]); 444 [this.profileInfo_.filePath, iconURL, name]);
442 if (name != this.profileInfo_.name) 445 if (name != this.profileInfo_.name)
443 options.ManagedUserListData.resetPromise(); 446 options.SupervisedUserListData.resetPromise();
444 }, 447 },
445 448
446 /** 449 /**
447 * Called when the user clicks "OK" or hits enter. Creates the profile 450 * Called when the user clicks "OK" or hits enter. Creates the profile
448 * using the information in the dialog. 451 * using the information in the dialog.
449 * @private 452 * @private
450 */ 453 */
451 submitCreateProfile_: function() { 454 submitCreateProfile_: function() {
452 // This is visual polish: the UI to access this should be disabled for 455 // This is visual polish: the UI to access this should be disabled for
453 // managed users, and the back end will prevent user creation anyway. 456 // supervised users, and the back end will prevent user creation anyway.
454 if (this.profileInfo_ && this.profileInfo_.isManaged) 457 if (this.profileInfo_ && this.profileInfo_.isSupervised)
455 return; 458 return;
456 459
457 this.hideErrorBubble_('create'); 460 this.hideErrorBubble_('create');
458 CreateProfileOverlay.updateCreateInProgress(true); 461 CreateProfileOverlay.updateCreateInProgress(true);
459 462
460 // Get the user's chosen name and icon, or default if they do not 463 // Get the user's chosen name and icon, or default if they do not
461 // wish to customize their profile. 464 // wish to customize their profile.
462 var name = $('create-profile-name').value; 465 var name = $('create-profile-name').value;
463 var iconUrl = $('create-profile-icon-grid').selectedItem; 466 var iconUrl = $('create-profile-icon-grid').selectedItem;
464 var createShortcut = $('create-shortcut').checked; 467 var createShortcut = $('create-shortcut').checked;
465 var isManaged = $('create-profile-managed').checked; 468 var isSupervised = $('create-profile-supervised').checked;
466 var existingManagedUserId = ''; 469 var existingSupervisedUserId = '';
467 470
468 // 'createProfile' is handled by the CreateProfileHandler. 471 // 'createProfile' is handled by the CreateProfileHandler.
469 chrome.send('createProfile', 472 chrome.send('createProfile',
470 [name, iconUrl, createShortcut, 473 [name, iconUrl, createShortcut,
471 isManaged, existingManagedUserId]); 474 isSupervised, existingSupervisedUserId]);
472 }, 475 },
473 476
474 /** 477 /**
475 * Called when the selected icon in the icon grid changes. 478 * Called when the selected icon in the icon grid changes.
476 * @param {string} mode A label that specifies the type of dialog box which 479 * @param {string} mode A label that specifies the type of dialog box which
477 * is currently being viewed (i.e. 'create' or 'manage'). 480 * is currently being viewed (i.e. 'create' or 'manage').
478 * @private 481 * @private
479 */ 482 */
480 onIconGridSelectionChanged_: function(mode) { 483 onIconGridSelectionChanged_: function(mode) {
481 var iconURL = $(mode + '-profile-icon-grid').selectedItem; 484 var iconURL = $(mode + '-profile-icon-grid').selectedItem;
(...skipping 19 matching lines...) Expand all
501 * @private 504 * @private
502 */ 505 */
503 prepareForManageDialog_: function() { 506 prepareForManageDialog_: function() {
504 chrome.send('refreshGaiaPicture'); 507 chrome.send('refreshGaiaPicture');
505 var profileInfo = BrowserOptions.getCurrentProfile(); 508 var profileInfo = BrowserOptions.getCurrentProfile();
506 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); 509 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage');
507 $('manage-profile-overlay-create').hidden = true; 510 $('manage-profile-overlay-create').hidden = true;
508 $('manage-profile-overlay-manage').hidden = false; 511 $('manage-profile-overlay-manage').hidden = false;
509 $('manage-profile-overlay-delete').hidden = true; 512 $('manage-profile-overlay-delete').hidden = true;
510 $('manage-profile-overlay-disconnect-managed').hidden = true; 513 $('manage-profile-overlay-disconnect-managed').hidden = true;
511 $('manage-profile-name').disabled = profileInfo.isManaged; 514 $('manage-profile-name').disabled = profileInfo.isSupervised;
512 this.hideErrorBubble_('manage'); 515 this.hideErrorBubble_('manage');
513 }, 516 },
514 517
515 /** 518 /**
516 * Display the "Manage Profile" dialog. 519 * Display the "Manage Profile" dialog.
517 * @private 520 * @private
518 */ 521 */
519 showManageDialog_: function() { 522 showManageDialog_: function() {
520 this.prepareForManageDialog_(); 523 this.prepareForManageDialog_();
521 OptionsPage.navigateToPage('manageProfile'); 524 OptionsPage.navigateToPage('manageProfile');
522 }, 525 },
523 526
524 /** 527 /**
525 * Display the "Delete Profile" dialog. 528 * Display the "Delete Profile" dialog.
526 * @param {Object} profileInfo The profile object of the profile to delete. 529 * @param {Object} profileInfo The profile object of the profile to delete.
527 * @private 530 * @private
528 */ 531 */
529 showDeleteDialog_: function(profileInfo) { 532 showDeleteDialog_: function(profileInfo) {
530 if (BrowserOptions.getCurrentProfile().isManaged) 533 if (BrowserOptions.getCurrentProfile().isSupervised)
531 return; 534 return;
532 535
533 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); 536 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage');
534 $('manage-profile-overlay-create').hidden = true; 537 $('manage-profile-overlay-create').hidden = true;
535 $('manage-profile-overlay-manage').hidden = true; 538 $('manage-profile-overlay-manage').hidden = true;
536 $('manage-profile-overlay-delete').hidden = false; 539 $('manage-profile-overlay-delete').hidden = false;
537 $('manage-profile-overlay-disconnect-managed').hidden = true; 540 $('manage-profile-overlay-disconnect-managed').hidden = true;
538 $('delete-profile-icon').style.content = 541 $('delete-profile-icon').style.content =
539 getProfileAvatarIcon(profileInfo.iconURL); 542 getProfileAvatarIcon(profileInfo.iconURL);
540 $('delete-profile-text').textContent = 543 $('delete-profile-text').textContent =
541 loadTimeData.getStringF('deleteProfileMessage', 544 loadTimeData.getStringF('deleteProfileMessage',
542 elide(profileInfo.name, /* maxLength */ 50)); 545 elide(profileInfo.name, /* maxLength */ 50));
543 $('delete-managed-profile-addendum').hidden = !profileInfo.isManaged; 546 $('delete-supervised-profile-addendum').hidden =
547 !profileInfo.isSupervised;
544 548
545 // Because this dialog isn't useful when refreshing or as part of the 549 // 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. 550 // history, don't create a history entry for it when showing.
547 OptionsPage.showPageByName('manageProfile', false); 551 OptionsPage.showPageByName('manageProfile', false);
548 }, 552 },
549 553
550 /** 554 /**
551 * Display the "Disconnect Managed Profile" dialog. 555 * Display the "Disconnect Managed Profile" dialog.
552 * @private 556 * @private
553 */ 557 */
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 CreateProfileOverlay.prototype = { 610 CreateProfileOverlay.prototype = {
607 // Inherit from ManageProfileOverlay. 611 // Inherit from ManageProfileOverlay.
608 __proto__: ManageProfileOverlay.prototype, 612 __proto__: ManageProfileOverlay.prototype,
609 613
610 // The signed-in email address of the current profile, or empty if they're 614 // The signed-in email address of the current profile, or empty if they're
611 // not signed in. 615 // not signed in.
612 signedInEmail_: '', 616 signedInEmail_: '',
613 617
614 /** @override */ 618 /** @override */
615 canShowPage: function() { 619 canShowPage: function() {
616 return !BrowserOptions.getCurrentProfile().isManaged; 620 return !BrowserOptions.getCurrentProfile().isSupervised;
617 }, 621 },
618 622
619 /** 623 /**
620 * Configures the overlay to the "create user" mode. 624 * Configures the overlay to the "create user" mode.
621 * @override 625 * @override
622 */ 626 */
623 didShowPage: function() { 627 didShowPage: function() {
624 chrome.send('requestCreateProfileUpdate'); 628 chrome.send('requestCreateProfileUpdate');
625 chrome.send('requestDefaultProfileIcons', ['create']); 629 chrome.send('requestDefaultProfileIcons', ['create']);
626 chrome.send('requestNewProfileDefaults'); 630 chrome.send('requestNewProfileDefaults');
627 631
628 $('manage-profile-overlay-create').hidden = false; 632 $('manage-profile-overlay-create').hidden = false;
629 $('manage-profile-overlay-manage').hidden = true; 633 $('manage-profile-overlay-manage').hidden = true;
630 $('manage-profile-overlay-delete').hidden = true; 634 $('manage-profile-overlay-delete').hidden = true;
631 $('manage-profile-overlay-disconnect-managed').hidden = true; 635 $('manage-profile-overlay-disconnect-managed').hidden = true;
632 $('create-profile-instructions').textContent = 636 $('create-profile-instructions').textContent =
633 loadTimeData.getStringF('createProfileInstructions'); 637 loadTimeData.getStringF('createProfileInstructions');
634 this.hideErrorBubble_(); 638 this.hideErrorBubble_();
635 this.updateCreateInProgress_(false); 639 this.updateCreateInProgress_(false);
636 640
637 var shortcutsEnabled = loadTimeData.getBoolean('profileShortcutsEnabled'); 641 var shortcutsEnabled = loadTimeData.getBoolean('profileShortcutsEnabled');
638 $('create-shortcut-container').hidden = !shortcutsEnabled; 642 $('create-shortcut-container').hidden = !shortcutsEnabled;
639 $('create-shortcut').checked = shortcutsEnabled; 643 $('create-shortcut').checked = shortcutsEnabled;
640 644
641 $('create-profile-name-label').hidden = true; 645 $('create-profile-name-label').hidden = true;
642 $('create-profile-name').hidden = true; 646 $('create-profile-name').hidden = true;
643 $('create-profile-ok').disabled = true; 647 $('create-profile-ok').disabled = true;
644 648
645 $('create-profile-managed').checked = false; 649 $('create-profile-supervised').checked = false;
646 $('import-existing-managed-user-link').hidden = true; 650 $('import-existing-supervised-user-link').hidden = true;
647 $('create-profile-managed').onchange = function() { 651 $('create-profile-supervised').onchange = function() {
648 ManageProfileOverlay.getInstance().updateCreateOrImport_('create'); 652 ManageProfileOverlay.getInstance().updateCreateOrImport_('create');
649 }; 653 };
650 $('create-profile-managed-signed-in').disabled = true; 654 $('create-profile-supervised-signed-in').disabled = true;
651 $('create-profile-managed-signed-in').hidden = true; 655 $('create-profile-supervised-signed-in').hidden = true;
652 $('create-profile-managed-not-signed-in').hidden = true; 656 $('create-profile-supervised-not-signed-in').hidden = true;
653 657
654 this.profileNameIsDefault_ = false; 658 this.profileNameIsDefault_ = false;
655 }, 659 },
656 660
657 /** @override */ 661 /** @override */
658 handleCancel: function() { 662 handleCancel: function() {
659 this.cancelCreateProfile_(); 663 this.cancelCreateProfile_();
660 }, 664 },
661 665
662 /** @override */ 666 /** @override */
(...skipping 11 matching lines...) Expand all
674 /** 678 /**
675 * Updates the UI when a profile create step begins or ends. 679 * Updates the UI when a profile create step begins or ends.
676 * Note that hideErrorBubble_() also enables the "OK" button, so it 680 * Note that hideErrorBubble_() also enables the "OK" button, so it
677 * must be called before this function if both are used. 681 * must be called before this function if both are used.
678 * @param {boolean} inProgress True if the UI should be updated to show that 682 * @param {boolean} inProgress True if the UI should be updated to show that
679 * profile creation is now in progress. 683 * profile creation is now in progress.
680 * @private 684 * @private
681 */ 685 */
682 updateCreateInProgress_: function(inProgress) { 686 updateCreateInProgress_: function(inProgress) {
683 this.createInProgress_ = inProgress; 687 this.createInProgress_ = inProgress;
684 this.updateCreateManagedUserCheckbox_(); 688 this.updateCreateSupervisedUserCheckbox_();
685 689
686 $('create-profile-icon-grid').disabled = inProgress; 690 $('create-profile-icon-grid').disabled = inProgress;
687 $('create-profile-name').disabled = inProgress; 691 $('create-profile-name').disabled = inProgress;
688 $('create-shortcut').disabled = inProgress; 692 $('create-shortcut').disabled = inProgress;
689 $('create-profile-ok').disabled = inProgress; 693 $('create-profile-ok').disabled = inProgress;
690 $('import-existing-managed-user-link').disabled = inProgress; 694 $('import-existing-supervised-user-link').disabled = inProgress;
691 695
692 $('create-profile-throbber').hidden = !inProgress; 696 $('create-profile-throbber').hidden = !inProgress;
693 }, 697 },
694 698
695 /** 699 /**
696 * Cancels the creation of the a profile. It is safe to call this even 700 * 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. 701 * when no profile is in the process of being created.
698 * @private 702 * @private
699 */ 703 */
700 cancelCreateProfile_: function() { 704 cancelCreateProfile_: function() {
(...skipping 25 matching lines...) Expand all
726 this.showErrorBubble_(warning); 730 this.showErrorBubble_(warning);
727 }, 731 },
728 732
729 /** 733 /**
730 * For new supervised users, shows a confirmation page after successfully 734 * For new supervised users, shows a confirmation page after successfully
731 * creating a new profile; otherwise, the handler will open a new window. 735 * creating a new profile; otherwise, the handler will open a new window.
732 * @param {Object} profileInfo An object of the form: 736 * @param {Object} profileInfo An object of the form:
733 * profileInfo = { 737 * profileInfo = {
734 * name: "Profile Name", 738 * name: "Profile Name",
735 * filePath: "/path/to/profile/data/on/disk" 739 * filePath: "/path/to/profile/data/on/disk"
736 * isManaged: (true|false), 740 * isSupervised: (true|false),
737 * }; 741 * };
738 * @private 742 * @private
739 */ 743 */
740 onSuccess_: function(profileInfo) { 744 onSuccess_: function(profileInfo) {
741 this.updateCreateInProgress_(false); 745 this.updateCreateInProgress_(false);
742 OptionsPage.closeOverlay(); 746 OptionsPage.closeOverlay();
743 if (profileInfo.isManaged) { 747 if (profileInfo.isSupervised) {
744 options.ManagedUserListData.resetPromise(); 748 options.SupervisedUserListData.resetPromise();
745 profileInfo.custodianEmail = this.signedInEmail_; 749 profileInfo.custodianEmail = this.signedInEmail_;
746 ManagedUserCreateConfirmOverlay.setProfileInfo(profileInfo); 750 SupervisedUserCreateConfirmOverlay.setProfileInfo(profileInfo);
747 OptionsPage.showPageByName('managedUserCreateConfirm', false); 751 OptionsPage.showPageByName('supervisedUserCreateConfirm', false);
748 BrowserOptions.updateManagesSupervisedUsers(true); 752 BrowserOptions.updateManagesSupervisedUsers(true);
749 } 753 }
750 }, 754 },
751 755
752 /** 756 /**
753 * Updates the signed-in or not-signed-in UI when in create mode. Called by 757 * Updates the signed-in or not-signed-in UI when in create mode. Called by
754 * the handler in response to the 'requestCreateProfileUpdate' message. 758 * the handler in response to the 'requestCreateProfileUpdate' message.
755 * updateManagedUsersAllowed_ is expected to be called after this is, and 759 * updateSupervisedUsersAllowed_ is expected to be called after this is, and
756 * will update additional UI elements. 760 * will update additional UI elements.
757 * @param {string} email The email address of the currently signed-in user. 761 * @param {string} email The email address of the currently signed-in user.
758 * An empty string indicates that the user is not signed in. 762 * An empty string indicates that the user is not signed in.
759 * @param {boolean} hasError Whether the user's sign-in credentials are 763 * @param {boolean} hasError Whether the user's sign-in credentials are
760 * still valid. 764 * still valid.
761 * @private 765 * @private
762 */ 766 */
763 updateSignedInStatus_: function(email, hasError) { 767 updateSignedInStatus_: function(email, hasError) {
764 this.signedInEmail_ = email; 768 this.signedInEmail_ = email;
765 this.hasError_ = hasError; 769 this.hasError_ = hasError;
766 var isSignedIn = email !== ''; 770 var isSignedIn = email !== '';
767 $('create-profile-managed-signed-in').hidden = !isSignedIn; 771 $('create-profile-supervised-signed-in').hidden = !isSignedIn;
768 $('create-profile-managed-not-signed-in').hidden = isSignedIn; 772 $('create-profile-supervised-not-signed-in').hidden = isSignedIn;
769 773
770 if (isSignedIn) { 774 if (isSignedIn) {
771 var accountDetailsOutOfDate = 775 var accountDetailsOutOfDate =
772 $('create-profile-managed-account-details-out-of-date-label'); 776 $('create-profile-supervised-account-details-out-of-date-label');
773 accountDetailsOutOfDate.textContent = loadTimeData.getStringF( 777 accountDetailsOutOfDate.textContent = loadTimeData.getStringF(
774 'manageProfilesManagedAccountDetailsOutOfDate', email); 778 'manageProfilesSupervisedAccountDetailsOutOfDate', email);
775 accountDetailsOutOfDate.hidden = !hasError; 779 accountDetailsOutOfDate.hidden = !hasError;
776 780
777 $('create-profile-managed-signed-in-label').textContent = 781 $('create-profile-supervised-signed-in-label').textContent =
778 loadTimeData.getStringF( 782 loadTimeData.getStringF(
779 'manageProfilesManagedSignedInLabel', email); 783 'manageProfilesSupervisedSignedInLabel', email);
780 $('create-profile-managed-signed-in-label').hidden = hasError; 784 $('create-profile-supervised-signed-in-label').hidden = hasError;
781 785
782 $('create-profile-managed-sign-in-again-link').hidden = !hasError; 786 $('create-profile-supervised-sign-in-again-link').hidden = !hasError;
783 $('create-profile-managed-signed-in-learn-more-link').hidden = hasError; 787 $('create-profile-supervised-signed-in-learn-more-link').hidden =
788 hasError;
784 } 789 }
785 790
786 this.updateImportExistingManagedUserLink_(isSignedIn && !hasError); 791 this.updateImportExistingSupervisedUserLink_(isSignedIn && !hasError);
787 }, 792 },
788 793
789 /** 794 /**
790 * Enables/disables the 'import existing managed users' link button. 795 * Enables/disables the 'import existing supervised users' link button.
791 * It also updates the button text. 796 * It also updates the button text.
792 * @param {boolean} enable True to enable the link button and 797 * @param {boolean} enable True to enable the link button and
793 * false otherwise. 798 * false otherwise.
794 * @private 799 * @private
795 */ 800 */
796 updateImportExistingManagedUserLink_: function(enable) { 801 updateImportExistingSupervisedUserLink_: function(enable) {
797 var importManagedUserElement = $('import-existing-managed-user-link'); 802 var importSupervisedUserElement =
798 importManagedUserElement.hidden = false; 803 $('import-existing-supervised-user-link');
799 importManagedUserElement.disabled = !enable || this.createInProgress_; 804 importSupervisedUserElement.hidden = false;
800 importManagedUserElement.textContent = enable ? 805 importSupervisedUserElement.disabled = !enable || this.createInProgress_;
801 loadTimeData.getString('importExistingManagedUserLink') : 806 importSupervisedUserElement.textContent = enable ?
802 loadTimeData.getString('signInToImportManagedUsers'); 807 loadTimeData.getString('importExistingSupervisedUserLink') :
808 loadTimeData.getString('signInToImportSupervisedUsers');
803 }, 809 },
804 810
805 /** 811 /**
806 * Sets whether creating managed users is allowed or not. Called by the 812 * Sets whether creating supervised users is allowed or not. Called by the
807 * handler in response to the 'requestCreateProfileUpdate' message or a 813 * handler in response to the 'requestCreateProfileUpdate' message or a
808 * change in the (policy-controlled) pref that prohibits creating managed 814 * change in the (policy-controlled) pref that prohibits creating supervised
809 * users, after the signed-in status has been updated. 815 * users, after the signed-in status has been updated.
810 * @param {boolean} allowed True if creating managed users should be 816 * @param {boolean} allowed True if creating supervised users should be
811 * allowed. 817 * allowed.
812 * @private 818 * @private
813 */ 819 */
814 updateManagedUsersAllowed_: function(allowed) { 820 updateSupervisedUsersAllowed_: function(allowed) {
815 this.managedUsersAllowed_ = allowed; 821 this.supervisedUsersAllowed_ = allowed;
816 this.updateCreateManagedUserCheckbox_(); 822 this.updateCreateSupervisedUserCheckbox_();
817 823
818 $('create-profile-managed-not-signed-in-link').hidden = !allowed; 824 $('create-profile-supervised-not-signed-in-link').hidden = !allowed;
819 if (!allowed) { 825 if (!allowed) {
820 $('create-profile-managed-indicator').setAttribute('controlled-by', 826 $('create-profile-supervised-indicator').setAttribute('controlled-by',
821 'policy'); 827 'policy');
822 } else { 828 } else {
823 $('create-profile-managed-indicator').removeAttribute('controlled-by'); 829 $('create-profile-supervised-indicator').removeAttribute(
830 'controlled-by');
824 } 831 }
825 }, 832 },
826 833
827 /** 834 /**
828 * Updates the status of the "create managed user" checkbox. Called from 835 * Updates the status of the "create supervised user" checkbox. Called from
829 * updateManagedUsersAllowed_() or updateCreateInProgress_(). 836 * updateSupervisedUsersAllowed_() or updateCreateInProgress_().
830 * updateSignedInStatus_() does not call this method directly, because it 837 * updateSignedInStatus_() does not call this method directly, because it
831 * will be followed by a call to updateManagedUsersAllowed_(). 838 * will be followed by a call to updateSupervisedUsersAllowed_().
832 * @private 839 * @private
833 */ 840 */
834 updateCreateManagedUserCheckbox_: function() { 841 updateCreateSupervisedUserCheckbox_: function() {
835 $('create-profile-managed').disabled = 842 $('create-profile-supervised').disabled =
836 !this.managedUsersAllowed_ || this.createInProgress_ || 843 !this.supervisedUsersAllowed_ || this.createInProgress_ ||
837 this.signedInEmail_ == '' || this.hasError_; 844 this.signedInEmail_ == '' || this.hasError_;
838 }, 845 },
839 }; 846 };
840 847
841 // Forward public APIs to private implementations. 848 // Forward public APIs to private implementations.
842 [ 849 [
843 'cancelCreateProfile', 850 'cancelCreateProfile',
844 'onError', 851 'onError',
845 'onSuccess', 852 'onSuccess',
846 'onWarning', 853 'onWarning',
847 'updateCreateInProgress', 854 'updateCreateInProgress',
848 'updateManagedUsersAllowed',
849 'updateSignedInStatus', 855 'updateSignedInStatus',
856 'updateSupervisedUsersAllowed',
850 ].forEach(function(name) { 857 ].forEach(function(name) {
851 CreateProfileOverlay[name] = function() { 858 CreateProfileOverlay[name] = function() {
852 var instance = CreateProfileOverlay.getInstance(); 859 var instance = CreateProfileOverlay.getInstance();
853 return instance[name + '_'].apply(instance, arguments); 860 return instance[name + '_'].apply(instance, arguments);
854 }; 861 };
855 }); 862 });
856 863
857 // Export 864 // Export
858 return { 865 return {
859 ManageProfileOverlay: ManageProfileOverlay, 866 ManageProfileOverlay: ManageProfileOverlay,
860 CreateProfileOverlay: CreateProfileOverlay, 867 CreateProfileOverlay: CreateProfileOverlay,
861 }; 868 };
862 }); 869 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698