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

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

Issue 1125343004: Add a "Simplify Page" option to the print preview dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for the failing tests Created 5 years, 4 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 <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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 /** 162 /**
163 * Component that renders miscellaneous print options. 163 * Component that renders miscellaneous print options.
164 * @type {!print_preview.OtherOptionsSettings} 164 * @type {!print_preview.OtherOptionsSettings}
165 * @private 165 * @private
166 */ 166 */
167 this.otherOptionsSettings_ = new print_preview.OtherOptionsSettings( 167 this.otherOptionsSettings_ = new print_preview.OtherOptionsSettings(
168 this.printTicketStore_.duplex, 168 this.printTicketStore_.duplex,
169 this.printTicketStore_.fitToPage, 169 this.printTicketStore_.fitToPage,
170 this.printTicketStore_.cssBackground, 170 this.printTicketStore_.cssBackground,
171 this.printTicketStore_.selectionOnly, 171 this.printTicketStore_.selectionOnly,
172 this.printTicketStore_.headerFooter); 172 this.printTicketStore_.headerFooter,
173 this.printTicketStore_.distillPage);
173 this.addChild(this.otherOptionsSettings_); 174 this.addChild(this.otherOptionsSettings_);
174 175
175 /** 176 /**
176 * Component that renders the advanced options button. 177 * Component that renders the advanced options button.
177 * @type {!print_preview.AdvancedOptionsSettings} 178 * @type {!print_preview.AdvancedOptionsSettings}
178 * @private 179 * @private
179 */ 180 */
180 this.advancedOptionsSettings_ = new print_preview.AdvancedOptionsSettings( 181 this.advancedOptionsSettings_ = new print_preview.AdvancedOptionsSettings(
181 this.printTicketStore_.vendorItems, this.destinationStore_); 182 this.printTicketStore_.vendorItems, this.destinationStore_);
182 this.addChild(this.advancedOptionsSettings_); 183 this.addChild(this.advancedOptionsSettings_);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS, 351 print_preview.NativeLayer.EventType.PRINT_PRESET_OPTIONS,
351 this.onPrintPresetOptionsFromDocument_.bind(this)); 352 this.onPrintPresetOptionsFromDocument_.bind(this));
352 this.tracker.add( 353 this.tracker.add(
353 this.nativeLayer_, 354 this.nativeLayer_,
354 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED, 355 print_preview.NativeLayer.EventType.PRIVET_PRINT_FAILED,
355 this.onPrivetPrintFailed_.bind(this)); 356 this.onPrivetPrintFailed_.bind(this));
356 this.tracker.add( 357 this.tracker.add(
357 this.nativeLayer_, 358 this.nativeLayer_,
358 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST, 359 print_preview.NativeLayer.EventType.MANIPULATE_SETTINGS_FOR_TEST,
359 this.onManipulateSettingsForTest_.bind(this)); 360 this.onManipulateSettingsForTest_.bind(this));
361 this.tracker.add(
362 this.nativeLayer_,
363 print_preview.NativeLayer.EventType.ALLOW_DISTILL_PAGE,
364 this.onAllowDistillPage_.bind(this));
360 365
361 if ($('system-dialog-link')) { 366 if ($('system-dialog-link')) {
362 this.tracker.add( 367 this.tracker.add(
363 $('system-dialog-link'), 368 $('system-dialog-link'),
364 'click', 369 'click',
365 this.openSystemPrintDialog_.bind(this)); 370 this.openSystemPrintDialog_.bind(this));
366 } 371 }
367 if ($('open-pdf-in-preview-link')) { 372 if ($('open-pdf-in-preview-link')) {
368 this.tracker.add( 373 this.tracker.add(
369 $('open-pdf-in-preview-link'), 374 $('open-pdf-in-preview-link'),
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 * @private 1012 * @private
1008 */ 1013 */
1009 onPrivetPrintFailed_: function(event) { 1014 onPrivetPrintFailed_: function(event) {
1010 console.error('Privet printing failed with error code ' + 1015 console.error('Privet printing failed with error code ' +
1011 event.httpError); 1016 event.httpError);
1012 this.printHeader_.setErrorMessage( 1017 this.printHeader_.setErrorMessage(
1013 loadTimeData.getString('couldNotPrint')); 1018 loadTimeData.getString('couldNotPrint'));
1014 }, 1019 },
1015 1020
1016 /** 1021 /**
1022 * Called when the native layer has detected that the "Distill page"
1023 * option should be allowed.
1024 * @private
1025 */
1026 onAllowDistillPage_: function(event) {
1027 this.printTicketStore_.distillPage.setIsCapabilityAvailable(true);
1028 },
1029
1030 /**
1017 * Called when the print preview settings need to be changed for testing. 1031 * Called when the print preview settings need to be changed for testing.
1018 * @param {Event} event Event object that contains the option that is to 1032 * @param {Event} event Event object that contains the option that is to
1019 * be changed and what to set that option. 1033 * be changed and what to set that option.
1020 * @private 1034 * @private
1021 */ 1035 */
1022 onManipulateSettingsForTest_: function(event) { 1036 onManipulateSettingsForTest_: function(event) {
1023 var settings = 1037 var settings =
1024 /** @type {print_preview.PreviewSettings} */(event.settings); 1038 /** @type {print_preview.PreviewSettings} */(event.settings);
1025 if ('selectSaveAsPdfDestination' in settings) { 1039 if ('selectSaveAsPdfDestination' in settings) {
1026 this.saveAsPdfForTest_(); // No parameters. 1040 this.saveAsPdfForTest_(); // No parameters.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 1277
1264 <include src="data/ticket_items/ticket_item.js"> 1278 <include src="data/ticket_items/ticket_item.js">
1265 1279
1266 <include src="data/ticket_items/custom_margins.js"> 1280 <include src="data/ticket_items/custom_margins.js">
1267 <include src="data/ticket_items/collate.js"> 1281 <include src="data/ticket_items/collate.js">
1268 <include src="data/ticket_items/color.js"> 1282 <include src="data/ticket_items/color.js">
1269 <include src="data/ticket_items/copies.js"> 1283 <include src="data/ticket_items/copies.js">
1270 <include src="data/ticket_items/dpi.js"> 1284 <include src="data/ticket_items/dpi.js">
1271 <include src="data/ticket_items/duplex.js"> 1285 <include src="data/ticket_items/duplex.js">
1272 <include src="data/ticket_items/header_footer.js"> 1286 <include src="data/ticket_items/header_footer.js">
1287 <include src="data/ticket_items/distill_page.js">
1273 <include src="data/ticket_items/media_size.js"> 1288 <include src="data/ticket_items/media_size.js">
1274 <include src="data/ticket_items/landscape.js"> 1289 <include src="data/ticket_items/landscape.js">
1275 <include src="data/ticket_items/margins_type.js"> 1290 <include src="data/ticket_items/margins_type.js">
1276 <include src="data/ticket_items/page_range.js"> 1291 <include src="data/ticket_items/page_range.js">
1277 <include src="data/ticket_items/fit_to_page.js"> 1292 <include src="data/ticket_items/fit_to_page.js">
1278 <include src="data/ticket_items/css_background.js"> 1293 <include src="data/ticket_items/css_background.js">
1279 <include src="data/ticket_items/selection_only.js"> 1294 <include src="data/ticket_items/selection_only.js">
1280 <include src="data/ticket_items/vendor_items.js"> 1295 <include src="data/ticket_items/vendor_items.js">
1281 1296
1282 <include src="native_layer.js"> 1297 <include src="native_layer.js">
(...skipping 30 matching lines...) Expand all
1313 <include src="search/recent_destination_list.js"> 1328 <include src="search/recent_destination_list.js">
1314 <include src="search/destination_list_item.js"> 1329 <include src="search/destination_list_item.js">
1315 <include src="search/destination_search.js"> 1330 <include src="search/destination_search.js">
1316 <include src="search/fedex_tos.js"> 1331 <include src="search/fedex_tos.js">
1317 <include src="search/provisional_destination_resolver.js"> 1332 <include src="search/provisional_destination_resolver.js">
1318 1333
1319 window.addEventListener('DOMContentLoaded', function() { 1334 window.addEventListener('DOMContentLoaded', function() {
1320 printPreview = new print_preview.PrintPreview(); 1335 printPreview = new print_preview.PrintPreview();
1321 printPreview.initialize(); 1336 printPreview.initialize();
1322 }); 1337 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698