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

Side by Side Diff: chrome/browser/resources/print_preview/print_preview.js

Issue 587013003: Add Print Preview UI to accept and reject printer sharing invitations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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 // 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 <include src="print_preview_focus_manager.js"> 10 <include src="print_preview_focus_manager.js">
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 /** 51 /**
52 * Data store which holds print destinations. 52 * Data store which holds print destinations.
53 * @type {!print_preview.DestinationStore} 53 * @type {!print_preview.DestinationStore}
54 * @private 54 * @private
55 */ 55 */
56 this.destinationStore_ = new print_preview.DestinationStore( 56 this.destinationStore_ = new print_preview.DestinationStore(
57 this.nativeLayer_, this.userInfo_, this.appState_); 57 this.nativeLayer_, this.userInfo_, this.appState_);
58 58
59 /** 59 /**
60 * Data store which holds printer sharing invitations.
61 * @type {!print_preview.InvitationStore}
62 * @private
63 */
64 this.invitationStore_ = new print_preview.InvitationStore(this.userInfo_);
65
66 /**
60 * Storage of the print ticket used to create the print job. 67 * Storage of the print ticket used to create the print job.
61 * @type {!print_preview.PrintTicketStore} 68 * @type {!print_preview.PrintTicketStore}
62 * @private 69 * @private
63 */ 70 */
64 this.printTicketStore_ = new print_preview.PrintTicketStore( 71 this.printTicketStore_ = new print_preview.PrintTicketStore(
65 this.destinationStore_, this.appState_, this.documentInfo_); 72 this.destinationStore_, this.appState_, this.documentInfo_);
66 73
67 /** 74 /**
68 * Holds the print and cancel buttons and renders some document statistics. 75 * Holds the print and cancel buttons and renders some document statistics.
69 * @type {!print_preview.PrintHeader} 76 * @type {!print_preview.PrintHeader}
70 * @private 77 * @private
71 */ 78 */
72 this.printHeader_ = new print_preview.PrintHeader( 79 this.printHeader_ = new print_preview.PrintHeader(
73 this.printTicketStore_, this.destinationStore_); 80 this.printTicketStore_, this.destinationStore_);
74 this.addChild(this.printHeader_); 81 this.addChild(this.printHeader_);
75 82
76 /** 83 /**
77 * Component used to search for print destinations. 84 * Component used to search for print destinations.
78 * @type {!print_preview.DestinationSearch} 85 * @type {!print_preview.DestinationSearch}
79 * @private 86 * @private
80 */ 87 */
81 this.destinationSearch_ = new print_preview.DestinationSearch( 88 this.destinationSearch_ = new print_preview.DestinationSearch(
82 this.destinationStore_, this.userInfo_); 89 this.destinationStore_, this.invitationStore_, this.userInfo_);
83 this.addChild(this.destinationSearch_); 90 this.addChild(this.destinationSearch_);
84 91
85 /** 92 /**
86 * Component that renders the print destination. 93 * Component that renders the print destination.
87 * @type {!print_preview.DestinationSettings} 94 * @type {!print_preview.DestinationSettings}
88 * @private 95 * @private
89 */ 96 */
90 this.destinationSettings_ = new print_preview.DestinationSettings( 97 this.destinationSettings_ = new print_preview.DestinationSettings(
91 this.destinationStore_); 98 this.destinationStore_);
92 this.addChild(this.destinationSettings_); 99 this.addChild(this.destinationSettings_);
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 this.cloudPrintInterface_, 665 this.cloudPrintInterface_,
659 cloudprint.CloudPrintInterface.EventType.PRINTER_FAILED, 666 cloudprint.CloudPrintInterface.EventType.PRINTER_FAILED,
660 this.onCloudPrintError_.bind(this)); 667 this.onCloudPrintError_.bind(this));
661 this.tracker.add( 668 this.tracker.add(
662 this.cloudPrintInterface_, 669 this.cloudPrintInterface_,
663 cloudprint.CloudPrintInterface.EventType. 670 cloudprint.CloudPrintInterface.EventType.
664 UPDATE_PRINTER_TOS_ACCEPTANCE_FAILED, 671 UPDATE_PRINTER_TOS_ACCEPTANCE_FAILED,
665 this.onCloudPrintError_.bind(this)); 672 this.onCloudPrintError_.bind(this));
666 673
667 this.destinationStore_.setCloudPrintInterface(this.cloudPrintInterface_); 674 this.destinationStore_.setCloudPrintInterface(this.cloudPrintInterface_);
675 this.invitationStore_.setCloudPrintInterface(this.cloudPrintInterface_);
668 if (this.destinationSearch_.getIsVisible()) { 676 if (this.destinationSearch_.getIsVisible()) {
669 this.destinationStore_.startLoadCloudDestinations(); 677 this.destinationStore_.startLoadCloudDestinations();
678 this.invitationStore_.startLoadingInvitations();
670 } 679 }
671 }, 680 },
672 681
673 /** 682 /**
674 * Called from the native layer when ready to print to Google Cloud Print. 683 * Called from the native layer when ready to print to Google Cloud Print.
675 * @param {Event} event Contains the body to send in the HTTP request. 684 * @param {Event} event Contains the body to send in the HTTP request.
676 * @private 685 * @private
677 */ 686 */
678 onPrintToCloud_: function(event) { 687 onPrintToCloud_: function(event) {
679 assert(this.uiState_ == PrintPreview.UiState_.PRINTING, 688 assert(this.uiState_ == PrintPreview.UiState_.PRINTING,
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 localStrings.getString('invalidPrinterSettings')); 913 localStrings.getString('invalidPrinterSettings'));
905 }, 914 },
906 915
907 /** 916 /**
908 * Called when the destination settings' change button is activated. 917 * Called when the destination settings' change button is activated.
909 * Displays the destination search component. 918 * Displays the destination search component.
910 * @private 919 * @private
911 */ 920 */
912 onDestinationChangeButtonActivate_: function() { 921 onDestinationChangeButtonActivate_: function() {
913 this.destinationSearch_.setIsVisible(true); 922 this.destinationSearch_.setIsVisible(true);
914 this.destinationStore_.startLoadCloudDestinations();
915 this.destinationStore_.startLoadLocalDestinations();
916 this.destinationStore_.startLoadPrivetDestinations();
917 }, 923 },
918 924
919 /** 925 /**
920 * Called when the destination settings' change button is activated. 926 * Called when the destination settings' change button is activated.
921 * Displays the destination search component. 927 * Displays the destination search component.
922 * @private 928 * @private
923 */ 929 */
924 onAdvancedOptionsButtonActivated_: function() { 930 onAdvancedOptionsButtonActivated_: function() {
925 this.advancedSettings_.showForDestination( 931 this.advancedSettings_.showForDestination(
926 this.destinationStore_.selectedDestination); 932 this.destinationStore_.selectedDestination);
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 // Pull in all other scripts in a single shot. 1226 // Pull in all other scripts in a single shot.
1221 <include src="common/overlay.js"> 1227 <include src="common/overlay.js">
1222 <include src="common/search_box.js"> 1228 <include src="common/search_box.js">
1223 <include src="common/search_bubble.js"> 1229 <include src="common/search_bubble.js">
1224 1230
1225 <include src="data/page_number_set.js"> 1231 <include src="data/page_number_set.js">
1226 <include src="data/destination.js"> 1232 <include src="data/destination.js">
1227 <include src="data/local_parsers.js"> 1233 <include src="data/local_parsers.js">
1228 <include src="data/cloud_parsers.js"> 1234 <include src="data/cloud_parsers.js">
1229 <include src="data/destination_store.js"> 1235 <include src="data/destination_store.js">
1236 <include src="data/invitation.js">
1237 <include src="data/invitation_store.js">
1230 <include src="data/margins.js"> 1238 <include src="data/margins.js">
1231 <include src="data/document_info.js"> 1239 <include src="data/document_info.js">
1232 <include src="data/printable_area.js"> 1240 <include src="data/printable_area.js">
1233 <include src="data/measurement_system.js"> 1241 <include src="data/measurement_system.js">
1234 <include src="data/print_ticket_store.js"> 1242 <include src="data/print_ticket_store.js">
1235 <include src="data/coordinate2d.js"> 1243 <include src="data/coordinate2d.js">
1236 <include src="data/size.js"> 1244 <include src="data/size.js">
1237 <include src="data/capabilities_holder.js"> 1245 <include src="data/capabilities_holder.js">
1238 <include src="data/user_info.js"> 1246 <include src="data/user_info.js">
1239 <include src="data/app_state.js"> 1247 <include src="data/app_state.js">
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 <include src="settings/margin_settings.js"> 1279 <include src="settings/margin_settings.js">
1272 <include src="settings/destination_settings.js"> 1280 <include src="settings/destination_settings.js">
1273 <include src="settings/other_options_settings.js"> 1281 <include src="settings/other_options_settings.js">
1274 <include src="settings/advanced_options_settings.js"> 1282 <include src="settings/advanced_options_settings.js">
1275 <include src="settings/advanced_settings/advanced_settings.js"> 1283 <include src="settings/advanced_settings/advanced_settings.js">
1276 <include src="settings/advanced_settings/advanced_settings_item.js"> 1284 <include src="settings/advanced_settings/advanced_settings_item.js">
1277 <include src="settings/more_settings.js"> 1285 <include src="settings/more_settings.js">
1278 1286
1279 <include src="previewarea/margin_control.js"> 1287 <include src="previewarea/margin_control.js">
1280 <include src="previewarea/margin_control_container.js"> 1288 <include src="previewarea/margin_control_container.js">
1281 <include src="../pdf/pdf_scripting_api.js" > 1289 <include src="../pdf/pdf_scripting_api.js">
1282 <include src="previewarea/preview_area.js"> 1290 <include src="previewarea/preview_area.js">
1283 <include src="preview_generator.js"> 1291 <include src="preview_generator.js">
1284 1292
1285 <include src="search/destination_list.js"> 1293 <include src="search/destination_list.js">
1286 <include src="search/cloud_destination_list.js"> 1294 <include src="search/cloud_destination_list.js">
1287 <include src="search/recent_destination_list.js"> 1295 <include src="search/recent_destination_list.js">
1288 <include src="search/destination_list_item.js"> 1296 <include src="search/destination_list_item.js">
1289 <include src="search/destination_search.js"> 1297 <include src="search/destination_search.js">
1290 <include src="search/fedex_tos.js"> 1298 <include src="search/fedex_tos.js">
1291 1299
1292 window.addEventListener('DOMContentLoaded', function() { 1300 window.addEventListener('DOMContentLoaded', function() {
1293 printPreview = new print_preview.PrintPreview(); 1301 printPreview = new print_preview.PrintPreview();
1294 printPreview.initialize(); 1302 printPreview.initialize();
1295 }); 1303 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698