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

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

Issue 2849733002: Fix Print Preview failure state and add test (Closed)
Patch Set: Fix nits Created 3 years, 7 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
« no previous file with comments | « no previous file | chrome/test/data/webui/print_preview.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // <include src="component.js"> 7 // <include src="component.js">
8 // <include src="print_preview_focus_manager.js"> 8 // <include src="print_preview_focus_manager.js">
9 9
10 cr.define('print_preview', function() { 10 cr.define('print_preview', function() {
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 }, 927 },
928 928
929 /** 929 /**
930 * Called when native layer receives invalid settings for a print request. 930 * Called when native layer receives invalid settings for a print request.
931 * @private 931 * @private
932 */ 932 */
933 onSettingsInvalid_: function() { 933 onSettingsInvalid_: function() {
934 this.uiState_ = PrintPreview.UiState_.ERROR; 934 this.uiState_ = PrintPreview.UiState_.ERROR;
935 this.isPreviewGenerationInProgress_ = false; 935 this.isPreviewGenerationInProgress_ = false;
936 this.printHeader_.isPrintButtonEnabled = false; 936 this.printHeader_.isPrintButtonEnabled = false;
937 console.error('Invalid settings error reported from native layer');
938 this.previewArea_.cancelTimeout(); 937 this.previewArea_.cancelTimeout();
939 this.previewArea_.showCustomMessage( 938 this.previewArea_.showCustomMessage(
940 loadTimeData.getString('invalidPrinterSettings')); 939 loadTimeData.getString('invalidPrinterSettings'));
941 }, 940 },
942 941
943 /** 942 /**
944 * Called when the destination settings' change button is activated. 943 * Called when the destination settings' change button is activated.
945 * Displays the destination search component. 944 * Displays the destination search component.
946 * @private 945 * @private
947 */ 946 */
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 /** 1192 /**
1194 * Called when a print destination is selected. Shows/hides the "Print with 1193 * Called when a print destination is selected. Shows/hides the "Print with
1195 * Cloud Print" link in the navbar. 1194 * Cloud Print" link in the navbar.
1196 * @private 1195 * @private
1197 */ 1196 */
1198 onDestinationSelect_: function() { 1197 onDestinationSelect_: function() {
1199 if ($('system-dialog-link')) { 1198 if ($('system-dialog-link')) {
1200 setIsVisible($('system-dialog-link'), 1199 setIsVisible($('system-dialog-link'),
1201 this.shouldShowSystemDialogLink_()); 1200 this.shouldShowSystemDialogLink_());
1202 } 1201 }
1202 // Reset if we had a bad settings fetch since the user selected a new
1203 // printer.
1204 if (this.uiState_ == PrintPreview.UiState_.ERROR)
1205 this.uiState_ = PrintPreview.UiState_.READY;
1203 if (this.destinationStore_.selectedDestination && 1206 if (this.destinationStore_.selectedDestination &&
1204 this.isInKioskAutoPrintMode_) { 1207 this.isInKioskAutoPrintMode_) {
1205 this.onPrintButtonClick_(); 1208 this.onPrintButtonClick_();
1206 } 1209 }
1207 }, 1210 },
1208 1211
1209 /** 1212 /**
1210 * Called when the destination store loads a group of destinations. Shows 1213 * Called when the destination store loads a group of destinations. Shows
1211 * a promo on Chrome OS if the user has no print destinations promoting 1214 * a promo on Chrome OS if the user has no print destinations promoting
1212 * Google Cloud Print. 1215 * Google Cloud Print.
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 // <include src="search/cloud_destination_list.js"> 1341 // <include src="search/cloud_destination_list.js">
1339 // <include src="search/recent_destination_list.js"> 1342 // <include src="search/recent_destination_list.js">
1340 // <include src="search/destination_list_item.js"> 1343 // <include src="search/destination_list_item.js">
1341 // <include src="search/destination_search.js"> 1344 // <include src="search/destination_search.js">
1342 // <include src="search/provisional_destination_resolver.js"> 1345 // <include src="search/provisional_destination_resolver.js">
1343 1346
1344 window.addEventListener('DOMContentLoaded', function() { 1347 window.addEventListener('DOMContentLoaded', function() {
1345 printPreview = new print_preview.PrintPreview(); 1348 printPreview = new print_preview.PrintPreview();
1346 printPreview.initialize(); 1349 printPreview.initialize();
1347 }); 1350 });
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/print_preview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698