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

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

Issue 407733002: [JS Changes] Support NumCopies print preset (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback (nit fixes for test case) Created 6 years 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 <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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 this.tracker.add( 340 this.tracker.add(
341 this.nativeLayer_, 341 this.nativeLayer_,
342 print_preview.NativeLayer.EventType.FILE_SELECTION_COMPLETE, 342 print_preview.NativeLayer.EventType.FILE_SELECTION_COMPLETE,
343 this.onFileSelectionComplete_.bind(this)); 343 this.onFileSelectionComplete_.bind(this));
344 this.tracker.add( 344 this.tracker.add(
345 this.nativeLayer_, 345 this.nativeLayer_,
346 print_preview.NativeLayer.EventType.SETTINGS_INVALID, 346 print_preview.NativeLayer.EventType.SETTINGS_INVALID,
347 this.onSettingsInvalid_.bind(this)); 347 this.onSettingsInvalid_.bind(this));
348 this.tracker.add( 348 this.tracker.add(
349 this.nativeLayer_, 349 this.nativeLayer_,
350 print_preview.NativeLayer.EventType.DISABLE_SCALING, 350 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS,
351 this.onDisableScaling_.bind(this)); 351 this.onPrintPresetOptionsFromDocument_.bind(this));
352 this.tracker.add( 352 this.tracker.add(
353 this.nativeLayer_, 353 this.nativeLayer_,
354 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, 354 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED,
355 this.onPrivetPrintFailed_.bind(this)); 355 this.onPrivetPrintFailed_.bind(this));
356 this.tracker.add( 356 this.tracker.add(
357 this.nativeLayer_, 357 this.nativeLayer_,
358 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, 358 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST,
359 this.onManipulateSettingsForTest_.bind(this)); 359 this.onManipulateSettingsForTest_.bind(this));
360 360
361 if ($('system-dialog-link')) { 361 if ($('system-dialog-link')) {
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 * corresponding native layer event. 972 * corresponding native layer event.
973 * @param {boolean} addAccount Whether to open an 'add a new account' or 973 * @param {boolean} addAccount Whether to open an 'add a new account' or
974 * default sign in page. 974 * default sign in page.
975 * @private 975 * @private
976 */ 976 */
977 onCloudPrintSignInActivated_: function(addAccount) { 977 onCloudPrintSignInActivated_: function(addAccount) {
978 this.nativeLayer_.startCloudPrintSignIn(addAccount); 978 this.nativeLayer_.startCloudPrintSignIn(addAccount);
979 }, 979 },
980 980
981 /** 981 /**
982 * Called when the native layer dispatches a DISABLE_SCALING event. Resets 982 * Updates printing options according to source document presets.
983 * fit-to-page selection and updates document info. 983 * @param {Event} event Contains options from source document.
984 * @private 984 * @private
985 */ 985 */
986 onDisableScaling_: function() { 986 onPrintPresetOptionsFromDocument_: function(event) {
987 this.printTicketStore_.fitToPage.updateValue(null); 987 if (event.optionsFromDocument.disableScaling) {
988 this.documentInfo_.updateIsScalingDisabled(true); 988 this.printTicketStore_.fitToPage.updateValue(null);
989 this.documentInfo_.updateIsScalingDisabled(true);
990 }
991
992 if (event.optionsFromDocument.copies > 0 &&
993 this.printTicketStore_.copies.isCapabilityAvailable()) {
994 this.printTicketStore_.copies.updateValue(
995 event.optionsFromDocument.copies);
996 }
989 }, 997 },
990 998
991 /** 999 /**
992 * Called when privet printing fails. 1000 * Called when privet printing fails.
993 * @param {Event} event Event object representing the failure. 1001 * @param {Event} event Event object representing the failure.
994 * @private 1002 * @private
995 */ 1003 */
996 onPrivetPrintFailed_: function(event) { 1004 onPrivetPrintFailed_: function(event) {
997 console.error('Privet printing failed with error code ' + 1005 console.error('Privet printing failed with error code ' +
998 event.httpError); 1006 event.httpError);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 <include src="search/cloud_destination_list.js"> 1307 <include src="search/cloud_destination_list.js">
1300 <include src="search/recent_destination_list.js"> 1308 <include src="search/recent_destination_list.js">
1301 <include src="search/destination_list_item.js"> 1309 <include src="search/destination_list_item.js">
1302 <include src="search/destination_search.js"> 1310 <include src="search/destination_search.js">
1303 <include src="search/fedex_tos.js"> 1311 <include src="search/fedex_tos.js">
1304 1312
1305 window.addEventListener('DOMContentLoaded', function() { 1313 window.addEventListener('DOMContentLoaded', function() {
1306 printPreview = new print_preview.PrintPreview(); 1314 printPreview = new print_preview.PrintPreview();
1307 printPreview.initialize(); 1315 printPreview.initialize();
1308 }); 1316 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/native_layer.js ('k') | chrome/browser/ui/webui/print_preview/print_preview_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698