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 // TODO(rltoscano): Move data/* into print_preview.data namespace | 5 // TODO(rltoscano): Move data/* into print_preview.data namespace |
6 | 6 |
7 var localStrings = new LocalStrings(templateData); | 7 var localStrings = new LocalStrings(templateData); |
8 | 8 |
9 <include src="component.js"/> | 9 <include src="component.js"/> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 this.nativeLayer_ = new print_preview.NativeLayer(); | 27 this.nativeLayer_ = new print_preview.NativeLayer(); |
28 | 28 |
29 /** | 29 /** |
30 * Event target that contains information about the logged in user. | 30 * Event target that contains information about the logged in user. |
31 * @type {!print_preview.UserInfo} | 31 * @type {!print_preview.UserInfo} |
32 * @private | 32 * @private |
33 */ | 33 */ |
34 this.userInfo_ = new print_preview.UserInfo(); | 34 this.userInfo_ = new print_preview.UserInfo(); |
35 | 35 |
36 /** | 36 /** |
| 37 * Metrics object used to report usage statistics. |
| 38 * @type {!print_preview.Metrics} |
| 39 * @private |
| 40 */ |
| 41 this.metrics_ = new print_preview.Metrics(); |
| 42 |
| 43 /** |
37 * Data store which holds print destinations. | 44 * Data store which holds print destinations. |
38 * @type {!print_preview.DestinationStore} | 45 * @type {!print_preview.DestinationStore} |
39 * @private | 46 * @private |
40 */ | 47 */ |
41 this.destinationStore_ = new print_preview.DestinationStore( | 48 this.destinationStore_ = new print_preview.DestinationStore( |
42 this.nativeLayer_); | 49 this.nativeLayer_); |
43 | 50 |
44 /** | 51 /** |
45 * Storage of the print ticket used to create the print job. | 52 * Storage of the print ticket used to create the print job. |
46 * @type {!print_preview.PrintTicketStore} | 53 * @type {!print_preview.PrintTicketStore} |
(...skipping 10 matching lines...) Expand all Loading... |
57 this.printHeader_ = new print_preview.PrintHeader( | 64 this.printHeader_ = new print_preview.PrintHeader( |
58 this.printTicketStore_, this.destinationStore_); | 65 this.printTicketStore_, this.destinationStore_); |
59 this.addChild(this.printHeader_); | 66 this.addChild(this.printHeader_); |
60 | 67 |
61 /** | 68 /** |
62 * Component used to search for print destinations. | 69 * Component used to search for print destinations. |
63 * @type {!print_preview.DestinationSearch} | 70 * @type {!print_preview.DestinationSearch} |
64 * @private | 71 * @private |
65 */ | 72 */ |
66 this.destinationSearch_ = new print_preview.DestinationSearch( | 73 this.destinationSearch_ = new print_preview.DestinationSearch( |
67 this.destinationStore_, this.userInfo_); | 74 this.destinationStore_, this.userInfo_, this.metrics_); |
68 this.addChild(this.destinationSearch_); | 75 this.addChild(this.destinationSearch_); |
69 | 76 |
70 /** | 77 /** |
71 * Component that renders the print destination. | 78 * Component that renders the print destination. |
72 * @type {!print_preview.DestinationSettings} | 79 * @type {!print_preview.DestinationSettings} |
73 * @private | 80 * @private |
74 */ | 81 */ |
75 this.destinationSettings_ = new print_preview.DestinationSettings( | 82 this.destinationSettings_ = new print_preview.DestinationSettings( |
76 this.destinationStore_); | 83 this.destinationStore_); |
77 this.addChild(this.destinationSettings_); | 84 this.addChild(this.destinationSettings_); |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 * to the preview area. | 611 * to the preview area. |
605 * @param {KeyboardEvent} e The keyboard event. | 612 * @param {KeyboardEvent} e The keyboard event. |
606 * @private | 613 * @private |
607 */ | 614 */ |
608 onKeyDown_: function(e) { | 615 onKeyDown_: function(e) { |
609 // Escape key closes the dialog. | 616 // Escape key closes the dialog. |
610 if (e.keyCode == 27 && !e.shiftKey && !e.ctrlKey && !e.altKey && | 617 if (e.keyCode == 27 && !e.shiftKey && !e.ctrlKey && !e.altKey && |
611 !e.metaKey) { | 618 !e.metaKey) { |
612 if (this.destinationSearch_.getIsVisible()) { | 619 if (this.destinationSearch_.getIsVisible()) { |
613 this.destinationSearch_.setIsVisible(false); | 620 this.destinationSearch_.setIsVisible(false); |
| 621 this.metrics_.increment( |
| 622 print_preview.Metrics.Bucket.DESTINATION_SELECTION_CANCELED); |
614 } else { | 623 } else { |
615 this.close_(); | 624 this.close_(); |
616 } | 625 } |
617 e.preventDefault(); | 626 e.preventDefault(); |
618 return; | 627 return; |
619 } | 628 } |
620 | 629 |
621 // Ctrl + Shift + p / Mac equivalent. | 630 // Ctrl + Shift + p / Mac equivalent. |
622 if (e.keyCode == 80) { | 631 if (e.keyCode == 80) { |
623 if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) || | 632 if ((cr.isMac && e.metaKey && e.altKey && !e.shiftKey && !e.ctrlKey) || |
(...skipping 19 matching lines...) Expand all Loading... |
643 }, | 652 }, |
644 | 653 |
645 /** | 654 /** |
646 * Called when the destination settings' change button is activated. | 655 * Called when the destination settings' change button is activated. |
647 * Displays the destination search component. | 656 * Displays the destination search component. |
648 * @private | 657 * @private |
649 */ | 658 */ |
650 onDestinationChangeButtonActivate_: function() { | 659 onDestinationChangeButtonActivate_: function() { |
651 this.destinationSearch_.setIsVisible(true); | 660 this.destinationSearch_.setIsVisible(true); |
652 this.destinationStore_.startLoadAllCloudDestinations(); | 661 this.destinationStore_.startLoadAllCloudDestinations(); |
| 662 this.metrics_.increment( |
| 663 print_preview.Metrics.Bucket.DESTINATION_SEARCH_SHOWN); |
653 }, | 664 }, |
654 | 665 |
655 /** | 666 /** |
656 * Called when the destination search dispatches manage cloud destinations | 667 * Called when the destination search dispatches manage cloud destinations |
657 * event. Calls corresponding native layer method. | 668 * event. Calls corresponding native layer method. |
658 * @private | 669 * @private |
659 */ | 670 */ |
660 onManageCloudDestinationsActivated_: function() { | 671 onManageCloudDestinationsActivated_: function() { |
661 this.nativeLayer_.startManageCloudDestinations(); | 672 this.nativeLayer_.startManageCloudDestinations(); |
662 }, | 673 }, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 <include src="data/ticket_items/landscape.js"/> | 735 <include src="data/ticket_items/landscape.js"/> |
725 <include src="data/ticket_items/margins_type.js"/> | 736 <include src="data/ticket_items/margins_type.js"/> |
726 <include src="data/ticket_items/page_range.js"/> | 737 <include src="data/ticket_items/page_range.js"/> |
727 <include src="data/ticket_items/fit_to_page.js"/> | 738 <include src="data/ticket_items/fit_to_page.js"/> |
728 | 739 |
729 <include src="native_layer.js"/> | 740 <include src="native_layer.js"/> |
730 <include src="print_preview_animations.js"/> | 741 <include src="print_preview_animations.js"/> |
731 <include src="cloud_print_interface.js"/> | 742 <include src="cloud_print_interface.js"/> |
732 <include src="print_preview_utils.js"/> | 743 <include src="print_preview_utils.js"/> |
733 <include src="print_header.js"/> | 744 <include src="print_header.js"/> |
| 745 <include src="metrics.js"/> |
734 | 746 |
735 <include src="settings/page_settings.js"/> | 747 <include src="settings/page_settings.js"/> |
736 <include src="settings/copies_settings.js"/> | 748 <include src="settings/copies_settings.js"/> |
737 <include src="settings/layout_settings.js"/> | 749 <include src="settings/layout_settings.js"/> |
738 <include src="settings/color_settings.js"/> | 750 <include src="settings/color_settings.js"/> |
739 <include src="settings/margin_settings.js"/> | 751 <include src="settings/margin_settings.js"/> |
740 <include src="settings/destination_settings.js"/> | 752 <include src="settings/destination_settings.js"/> |
741 <include src="settings/other_options_settings.js"/> | 753 <include src="settings/other_options_settings.js"/> |
742 | 754 |
743 <include src="previewarea/margin_control.js"/> | 755 <include src="previewarea/margin_control.js"/> |
744 <include src="previewarea/margin_control_container.js"/> | 756 <include src="previewarea/margin_control_container.js"/> |
745 <include src="previewarea/preview_area.js"/> | 757 <include src="previewarea/preview_area.js"/> |
746 <include src="preview_generator.js"/> | 758 <include src="preview_generator.js"/> |
747 | 759 |
748 <include src="search/destination_list.js"/> | 760 <include src="search/destination_list.js"/> |
749 <include src="search/cloud_destination_list.js"/> | 761 <include src="search/cloud_destination_list.js"/> |
750 <include src="search/destination_list_item.js"/> | 762 <include src="search/destination_list_item.js"/> |
751 <include src="search/destination_search.js"/> | 763 <include src="search/destination_search.js"/> |
752 <include src="search/search_box.js"/> | 764 <include src="search/search_box.js"/> |
753 | 765 |
754 window.addEventListener('DOMContentLoaded', function() { | 766 window.addEventListener('DOMContentLoaded', function() { |
755 printPreview = new print_preview.PrintPreview(); | 767 printPreview = new print_preview.PrintPreview(); |
756 printPreview.initialize(); | 768 printPreview.initialize(); |
757 }); | 769 }); |
OLD | NEW |