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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 }, | 452 }, |
453 | 453 |
454 /** | 454 /** |
455 * Updates printer sharing invitations UI. | 455 * Updates printer sharing invitations UI. |
456 * @private | 456 * @private |
457 */ | 457 */ |
458 updateInvitations_: function() { | 458 updateInvitations_: function() { |
459 var invitations = this.userInfo_.activeUser ? | 459 var invitations = this.userInfo_.activeUser ? |
460 this.invitationStore_.invitations(this.userInfo_.activeUser) : []; | 460 this.invitationStore_.invitations(this.userInfo_.activeUser) : []; |
461 if (invitations.length > 0) { | 461 if (invitations.length > 0) { |
| 462 if (this.invitation_ != invitations[0]) { |
| 463 this.metrics_.record(print_preview.Metrics.DestinationSearchBucket. |
| 464 INVITATION_AVAILABLE); |
| 465 } |
462 this.invitation_ = invitations[0]; | 466 this.invitation_ = invitations[0]; |
463 this.showInvitation_(this.invitation_); | 467 this.showInvitation_(this.invitation_); |
464 } else { | 468 } else { |
465 this.invitation_ = null; | 469 this.invitation_ = null; |
466 } | 470 } |
467 setIsVisible( | 471 setIsVisible( |
468 this.getChildElement('.invitation-container'), !!this.invitation_); | 472 this.getChildElement('.invitation-container'), !!this.invitation_); |
469 this.reflowLists_(); | 473 this.reflowLists_(); |
470 }, | 474 }, |
471 | 475 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
654 print_preview.Metrics.DestinationSearchBucket.ADD_ACCOUNT_SELECTED); | 658 print_preview.Metrics.DestinationSearchBucket.ADD_ACCOUNT_SELECTED); |
655 } | 659 } |
656 }, | 660 }, |
657 | 661 |
658 /** | 662 /** |
659 * Called when the printer sharing invitation Accept/Reject button is | 663 * Called when the printer sharing invitation Accept/Reject button is |
660 * clicked. | 664 * clicked. |
661 * @private | 665 * @private |
662 */ | 666 */ |
663 onInvitationProcessButtonClick_: function(accept) { | 667 onInvitationProcessButtonClick_: function(accept) { |
| 668 this.metrics_.record(accept ? |
| 669 print_preview.Metrics.DestinationSearchBucket.INVITATION_ACCEPTED : |
| 670 print_preview.Metrics.DestinationSearchBucket.INVITATION_REJECTED); |
664 this.invitationStore_.processInvitation(this.invitation_, accept); | 671 this.invitationStore_.processInvitation(this.invitation_, accept); |
665 this.updateInvitations_(); | 672 this.updateInvitations_(); |
666 }, | 673 }, |
667 | 674 |
668 /** | 675 /** |
669 * Called when the close button on the cloud print promo is clicked. Hides | 676 * Called when the close button on the cloud print promo is clicked. Hides |
670 * the promo. | 677 * the promo. |
671 * @private | 678 * @private |
672 */ | 679 */ |
673 onCloudprintPromoCloseButtonClick_: function() { | 680 onCloudprintPromoCloseButtonClick_: function() { |
674 setIsVisible(this.getChildElement('.cloudprint-promo'), false); | 681 setIsVisible(this.getChildElement('.cloudprint-promo'), false); |
675 }, | 682 }, |
676 | 683 |
677 /** | 684 /** |
678 * Called when the window is resized. Reflows layout of destination lists. | 685 * Called when the window is resized. Reflows layout of destination lists. |
679 * @private | 686 * @private |
680 */ | 687 */ |
681 onWindowResize_: function() { | 688 onWindowResize_: function() { |
682 this.reflowLists_(); | 689 this.reflowLists_(); |
683 } | 690 } |
684 }; | 691 }; |
685 | 692 |
686 // Export | 693 // Export |
687 return { | 694 return { |
688 DestinationSearch: DestinationSearch | 695 DestinationSearch: DestinationSearch |
689 }; | 696 }; |
690 }); | 697 }); |
OLD | NEW |