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

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 (add kSettingDisableScaling, remove dead code) Created 6 years, 1 month 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.DISABLE_SCALING,
351 this.onDisableScaling_.bind(this)); 351 this.onDisableScaling_.bind(this));
Aleksey Shlyapnikov 2014/11/21 22:50:42 Please remove _all_ obsolete code.
Nikhil 2014/11/24 12:57:30 Done.
352 this.tracker.add( 352 this.tracker.add(
353 this.nativeLayer_, 353 this.nativeLayer_,
354 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS,
355 this.onPrintPresetOptionsFromDocument_.bind(this));
356 this.tracker.add(
357 this.nativeLayer_,
354 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, 358 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED,
355 this.onPrivetPrintFailed_.bind(this)); 359 this.onPrivetPrintFailed_.bind(this));
356 this.tracker.add( 360 this.tracker.add(
357 this.nativeLayer_, 361 this.nativeLayer_,
358 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, 362 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST,
359 this.onManipulateSettingsForTest_.bind(this)); 363 this.onManipulateSettingsForTest_.bind(this));
360 364
361 if ($('system-dialog-link')) { 365 if ($('system-dialog-link')) {
362 this.tracker.add( 366 this.tracker.add(
363 $('system-dialog-link'), 367 $('system-dialog-link'),
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 }, 983 },
980 984
981 /** 985 /**
982 * Called when the native layer dispatches a DISABLE_SCALING event. Resets 986 * Called when the native layer dispatches a DISABLE_SCALING event. Resets
983 * fit-to-page selection and updates document info. 987 * fit-to-page selection and updates document info.
984 * @private 988 * @private
985 */ 989 */
986 onDisableScaling_: function() { 990 onDisableScaling_: function() {
987 this.printTicketStore_.fitToPage.updateValue(null); 991 this.printTicketStore_.fitToPage.updateValue(null);
988 this.documentInfo_.updateIsScalingDisabled(true); 992 this.documentInfo_.updateIsScalingDisabled(true);
989 }, 993 },
Aleksey Shlyapnikov 2014/11/21 22:50:42 Please remove _all_ obsolete code.
Nikhil 2014/11/24 12:57:30 Done.
990 994
991 /** 995 /**
996 * Called when the native layer dispatches a PRINT_PRESET_OPTIONS event. It
997 * updates the print preset options from source document.
Aleksey Shlyapnikov 2014/11/21 22:50:42 Just one sentence: Updates printing options accor
Nikhil 2014/11/24 12:57:30 Done.
998 * @param {event} event Contains options from source document.
Aleksey Shlyapnikov 2014/11/21 22:50:42 event -> Event
Nikhil 2014/11/24 12:57:30 Done.
999 * @private
1000 */
1001 onPrintPresetOptionsFromDocument_: function(event) {
1002 if (event.optionsFromDocument.disableScaling)
1003 this.onDisableScaling_();
1004
1005 if (this.printTicketStore_.copies.isCapabilityAvailable() &&
1006 event.optionsFromDocument.copies) {
Aleksey Shlyapnikov 2014/11/21 22:50:42 Let's swap checks and add sanity check: if (event
Nikhil 2014/11/24 12:57:30 Done.
1007 this.printTicketStore_.copies.updateValue(
1008 event.optionsFromDocument.copies);
1009 }
1010 },
1011
1012 /**
992 * Called when privet printing fails. 1013 * Called when privet printing fails.
993 * @param {Event} event Event object representing the failure. 1014 * @param {Event} event Event object representing the failure.
994 * @private 1015 * @private
995 */ 1016 */
996 onPrivetPrintFailed_: function(event) { 1017 onPrivetPrintFailed_: function(event) {
997 console.error('Privet printing failed with error code ' + 1018 console.error('Privet printing failed with error code ' +
998 event.httpError); 1019 event.httpError);
999 this.printHeader_.setErrorMessage( 1020 this.printHeader_.setErrorMessage(
1000 loadTimeData.getString('couldNotPrint')); 1021 loadTimeData.getString('couldNotPrint'));
1001 }, 1022 },
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 <include src="search/cloud_destination_list.js"> 1320 <include src="search/cloud_destination_list.js">
1300 <include src="search/recent_destination_list.js"> 1321 <include src="search/recent_destination_list.js">
1301 <include src="search/destination_list_item.js"> 1322 <include src="search/destination_list_item.js">
1302 <include src="search/destination_search.js"> 1323 <include src="search/destination_search.js">
1303 <include src="search/fedex_tos.js"> 1324 <include src="search/fedex_tos.js">
1304 1325
1305 window.addEventListener('DOMContentLoaded', function() { 1326 window.addEventListener('DOMContentLoaded', function() {
1306 printPreview = new print_preview.PrintPreview(); 1327 printPreview = new print_preview.PrintPreview();
1307 printPreview.initialize(); 1328 printPreview.initialize();
1308 }); 1329 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698