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

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

Issue 220593003: [Canceled] Show a "downloads in progress" warning in the delete profile overlay. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 * message. 251 * message.
252 * @param {boolean} hasShortcuts Whether profile has any existing shortcuts. 252 * @param {boolean} hasShortcuts Whether profile has any existing shortcuts.
253 * @private 253 * @private
254 */ 254 */
255 receiveHasProfileShortcuts_: function(hasShortcuts) { 255 receiveHasProfileShortcuts_: function(hasShortcuts) {
256 $('add-shortcut-button').hidden = hasShortcuts; 256 $('add-shortcut-button').hidden = hasShortcuts;
257 $('remove-shortcut-button').hidden = !hasShortcuts; 257 $('remove-shortcut-button').hidden = !hasShortcuts;
258 }, 258 },
259 259
260 /** 260 /**
261 * Callback to show a "downloads in progress" warning in delete mode,
262 * called by the handler as a result of the
263 * 'requestProfileInProgressDownloads_' message.
264 * @param {number} downloadCount Number of in-progress downloads.
265 * @private
266 */
267 receiveDownloadCount_: function(downloadCount) {
268 var singleDownload = downloadCount == 1;
269 var multipleDownloads = downloadCount > 1;
270 $('delete-profile-single-download-addendum').hidden = !singleDownload;
271 $('delete-profile-multiple-downloads-addendum').hidden =
272 !multipleDownloads;
273 },
274
275 /**
261 * Display the error bubble, with |errorHtml| in the bubble. 276 * Display the error bubble, with |errorHtml| in the bubble.
262 * @param {string} errorHtml The html string to display as an error. 277 * @param {string} errorHtml The html string to display as an error.
263 * @param {string} mode A label that specifies the type of dialog box which 278 * @param {string} mode A label that specifies the type of dialog box which
264 * is currently being viewed (i.e. 'create' or 'manage'). 279 * is currently being viewed (i.e. 'create' or 'manage').
265 * @param {boolean} disableOKButton True if the dialog's OK button should be 280 * @param {boolean} disableOKButton True if the dialog's OK button should be
266 * disabled when the error bubble is shown. It will be (re-)enabled when 281 * disabled when the error bubble is shown. It will be (re-)enabled when
267 * the error bubble is hidden. 282 * the error bubble is hidden.
268 * @private 283 * @private
269 */ 284 */
270 showErrorBubble_: function(errorHtml, mode, disableOKButton) { 285 showErrorBubble_: function(errorHtml, mode, disableOKButton) {
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage'); 506 ManageProfileOverlay.setProfileInfo(profileInfo, 'manage');
492 $('manage-profile-overlay-create').hidden = true; 507 $('manage-profile-overlay-create').hidden = true;
493 $('manage-profile-overlay-manage').hidden = true; 508 $('manage-profile-overlay-manage').hidden = true;
494 $('manage-profile-overlay-delete').hidden = false; 509 $('manage-profile-overlay-delete').hidden = false;
495 $('manage-profile-overlay-disconnect-managed').hidden = true; 510 $('manage-profile-overlay-disconnect-managed').hidden = true;
496 $('delete-profile-icon').style.content = 511 $('delete-profile-icon').style.content =
497 getProfileAvatarIcon(profileInfo.iconURL); 512 getProfileAvatarIcon(profileInfo.iconURL);
498 $('delete-profile-text').textContent = 513 $('delete-profile-text').textContent =
499 loadTimeData.getStringF('deleteProfileMessage', 514 loadTimeData.getStringF('deleteProfileMessage',
500 elide(profileInfo.name, /* maxLength */ 50)); 515 elide(profileInfo.name, /* maxLength */ 50));
516 $('delete-profile-single-download-addendum').hidden = true;
517 $('delete-profile-multiple-downloads-addendum').hidden = true;
501 $('delete-managed-profile-addendum').hidden = !profileInfo.isManaged; 518 $('delete-managed-profile-addendum').hidden = !profileInfo.isManaged;
502 519
520 chrome.send('requestProfileInProgressDownloads', [profileInfo.filePath]);
521
503 // Because this dialog isn't useful when refreshing or as part of the 522 // Because this dialog isn't useful when refreshing or as part of the
504 // history, don't create a history entry for it when showing. 523 // history, don't create a history entry for it when showing.
505 OptionsPage.showPageByName('manageProfile', false); 524 OptionsPage.showPageByName('manageProfile', false);
506 }, 525 },
507 526
508 /** 527 /**
509 * Display the "Disconnect Managed Profile" dialog. 528 * Display the "Disconnect Managed Profile" dialog.
510 * @private 529 * @private
511 */ 530 */
512 showDisconnectManagedProfileDialog_: function() { 531 showDisconnectManagedProfileDialog_: function() {
(...skipping 15 matching lines...) Expand all
528 OptionsPage.navigateToPage('createProfile'); 547 OptionsPage.navigateToPage('createProfile');
529 }, 548 },
530 }; 549 };
531 550
532 // Forward public APIs to private implementations. 551 // Forward public APIs to private implementations.
533 [ 552 [
534 'receiveDefaultProfileIcons', 553 'receiveDefaultProfileIcons',
535 'receiveNewProfileDefaults', 554 'receiveNewProfileDefaults',
536 'receiveProfileNames', 555 'receiveProfileNames',
537 'receiveHasProfileShortcuts', 556 'receiveHasProfileShortcuts',
557 'receiveDownloadCount',
538 'setProfileInfo', 558 'setProfileInfo',
539 'setProfileName', 559 'setProfileName',
540 'showManageDialog', 560 'showManageDialog',
541 'showDeleteDialog', 561 'showDeleteDialog',
542 'showDisconnectManagedProfileDialog', 562 'showDisconnectManagedProfileDialog',
543 'showCreateDialog', 563 'showCreateDialog',
544 ].forEach(function(name) { 564 ].forEach(function(name) {
545 ManageProfileOverlay[name] = function() { 565 ManageProfileOverlay[name] = function() {
546 var instance = ManageProfileOverlay.getInstance(); 566 var instance = ManageProfileOverlay.getInstance();
547 return instance[name + '_'].apply(instance, arguments); 567 return instance[name + '_'].apply(instance, arguments);
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 return instance[name + '_'].apply(instance, arguments); 828 return instance[name + '_'].apply(instance, arguments);
809 }; 829 };
810 }); 830 });
811 831
812 // Export 832 // Export
813 return { 833 return {
814 ManageProfileOverlay: ManageProfileOverlay, 834 ManageProfileOverlay: ManageProfileOverlay,
815 CreateProfileOverlay: CreateProfileOverlay, 835 CreateProfileOverlay: CreateProfileOverlay,
816 }; 836 };
817 }); 837 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698