| 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('print_preview', function() { | 5 cr.define('print_preview', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Component used for searching for a print destination. | 9 * Component used for searching for a print destination. |
| 10 * This is a modal dialog that allows the user to search and select a | 10 * This is a modal dialog that allows the user to search and select a |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * Data store containing the destinations to search through. | 26 * Data store containing the destinations to search through. |
| 27 * @type {!print_preview.DestinationStore} | 27 * @type {!print_preview.DestinationStore} |
| 28 * @private | 28 * @private |
| 29 */ | 29 */ |
| 30 this.destinationStore_ = destinationStore; | 30 this.destinationStore_ = destinationStore; |
| 31 | 31 |
| 32 /** | 32 /** |
| 33 * Data store holding printer sharing invitations. | 33 * Data store holding printer sharing invitations. |
| 34 * @type {!print_preview.DestinationStore} | 34 * @type {!print_preview.InvitationStore} |
| 35 * @private | 35 * @private |
| 36 */ | 36 */ |
| 37 this.invitationStore_ = invitationStore; | 37 this.invitationStore_ = invitationStore; |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * Event target that contains information about the logged in user. | 40 * Event target that contains information about the logged in user. |
| 41 * @type {!print_preview.UserInfo} | 41 * @type {!print_preview.UserInfo} |
| 42 * @private | 42 * @private |
| 43 */ | 43 */ |
| 44 this.userInfo_ = userInfo; | 44 this.userInfo_ = userInfo; |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 this.showInvitation_(this.invitation_); | 463 this.showInvitation_(this.invitation_); |
| 464 } else { | 464 } else { |
| 465 this.invitation_ = null; | 465 this.invitation_ = null; |
| 466 } | 466 } |
| 467 setIsVisible( | 467 setIsVisible( |
| 468 this.getChildElement('.invitation-container'), !!this.invitation_); | 468 this.getChildElement('.invitation-container'), !!this.invitation_); |
| 469 this.reflowLists_(); | 469 this.reflowLists_(); |
| 470 }, | 470 }, |
| 471 | 471 |
| 472 /** | 472 /** |
| 473 * @param {!printe_preview.Invitation} invitation Invitation to show. | 473 * @param {!print_preview.Invitation} invitation Invitation to show. |
| 474 * @private | 474 * @private |
| 475 */ | 475 */ |
| 476 showInvitation_: function(invitation) { | 476 showInvitation_: function(invitation) { |
| 477 var invitationText = ''; | 477 var invitationText = ''; |
| 478 if (invitation.asGroupManager) { | 478 if (invitation.asGroupManager) { |
| 479 invitationText = loadTimeData.getStringF( | 479 invitationText = loadTimeData.getStringF( |
| 480 'groupPrinterSharingInviteText', | 480 'groupPrinterSharingInviteText', |
| 481 invitation.sender, | 481 invitation.sender, |
| 482 invitation.destination.displayName, | 482 invitation.destination.displayName, |
| 483 invitation.receiver); | 483 invitation.receiver); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 print_preview.Metrics.DestinationSearchBucket.ADD_ACCOUNT_SELECTED); | 654 print_preview.Metrics.DestinationSearchBucket.ADD_ACCOUNT_SELECTED); |
| 655 } | 655 } |
| 656 }, | 656 }, |
| 657 | 657 |
| 658 /** | 658 /** |
| 659 * Called when the printer sharing invitation Accept/Reject button is | 659 * Called when the printer sharing invitation Accept/Reject button is |
| 660 * clicked. | 660 * clicked. |
| 661 * @private | 661 * @private |
| 662 */ | 662 */ |
| 663 onInvitationProcessButtonClick_: function(accept) { | 663 onInvitationProcessButtonClick_: function(accept) { |
| 664 this.invitationStore_.processInvitation(this.invitation_, accept); | 664 var invitation = assert(this.invitation_); |
| 665 this.invitationStore_.processInvitation(invitation, accept); |
| 665 this.updateInvitations_(); | 666 this.updateInvitations_(); |
| 666 }, | 667 }, |
| 667 | 668 |
| 668 /** | 669 /** |
| 669 * Called when the close button on the cloud print promo is clicked. Hides | 670 * Called when the close button on the cloud print promo is clicked. Hides |
| 670 * the promo. | 671 * the promo. |
| 671 * @private | 672 * @private |
| 672 */ | 673 */ |
| 673 onCloudprintPromoCloseButtonClick_: function() { | 674 onCloudprintPromoCloseButtonClick_: function() { |
| 674 setIsVisible(this.getChildElement('.cloudprint-promo'), false); | 675 setIsVisible(this.getChildElement('.cloudprint-promo'), false); |
| 675 }, | 676 }, |
| 676 | 677 |
| 677 /** | 678 /** |
| 678 * Called when the window is resized. Reflows layout of destination lists. | 679 * Called when the window is resized. Reflows layout of destination lists. |
| 679 * @private | 680 * @private |
| 680 */ | 681 */ |
| 681 onWindowResize_: function() { | 682 onWindowResize_: function() { |
| 682 this.reflowLists_(); | 683 this.reflowLists_(); |
| 683 } | 684 } |
| 684 }; | 685 }; |
| 685 | 686 |
| 686 // Export | 687 // Export |
| 687 return { | 688 return { |
| 688 DestinationSearch: DestinationSearch | 689 DestinationSearch: DestinationSearch |
| 689 }; | 690 }; |
| 690 }); | 691 }); |
| OLD | NEW |