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

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

Issue 12209086: Page range comparisons should use document size. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
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 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * An interface to the native Chromium printing system layer. 9 * An interface to the native Chromium printing system layer.
10 * @constructor 10 * @constructor
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 * - PREVIEW_RELOAD 133 * - PREVIEW_RELOAD
134 * @param {print_preview.Destination} destination Destination to print to. 134 * @param {print_preview.Destination} destination Destination to print to.
135 * @param {!print_preview.PrintTicketStore} printTicketStore Used to get the 135 * @param {!print_preview.PrintTicketStore} printTicketStore Used to get the
136 * state of the print ticket. 136 * state of the print ticket.
137 * @param {number} ID of the preview request. 137 * @param {number} ID of the preview request.
138 */ 138 */
139 startGetPreview: function(destination, printTicketStore, requestId) { 139 startGetPreview: function(destination, printTicketStore, requestId) {
140 assert(printTicketStore.isTicketValidForPreview(), 140 assert(printTicketStore.isTicketValidForPreview(),
141 'Trying to generate preview when ticket is not valid'); 141 'Trying to generate preview when ticket is not valid');
142 142
143 var pageRanges =
144 (requestId > 0 && printTicketStore.hasPageRangeCapability()) ?
145 printTicketStore.getPageNumberSet().getPageRanges() : [];
146
147 var ticket = { 143 var ticket = {
148 'pageRange': pageRanges, 144 'pageRange': printTicketStore.getDocumentPageRanges(),
Toscano 2013/02/12 01:39:05 Can we just pass in printTicketStore.getPageRanges
Vitaly Buka (NO REVIEWS) 2013/02/12 01:45:30 Huge arrays of pages. On 2013/02/12 01:39:05, T
149 'landscape': printTicketStore.isLandscapeEnabled(), 145 'landscape': printTicketStore.isLandscapeEnabled(),
150 'color': printTicketStore.isColorEnabled() ? 146 'color': printTicketStore.isColorEnabled() ?
151 NativeLayer.ColorMode_.COLOR : NativeLayer.ColorMode_.GRAY, 147 NativeLayer.ColorMode_.COLOR : NativeLayer.ColorMode_.GRAY,
152 'headerFooterEnabled': printTicketStore.isHeaderFooterEnabled(), 148 'headerFooterEnabled': printTicketStore.isHeaderFooterEnabled(),
153 'marginsType': printTicketStore.getMarginsType(), 149 'marginsType': printTicketStore.getMarginsType(),
154 'isFirstRequest': requestId == 0, 150 'isFirstRequest': requestId == 0,
155 'requestID': requestId, 151 'requestID': requestId,
156 'previewModifiable': printTicketStore.isDocumentModifiable, 152 'previewModifiable': printTicketStore.isDocumentModifiable,
157 'printToPDF': 153 'printToPDF':
158 destination != null && 154 destination != null &&
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 * to Google Cloud Print. 204 * to Google Cloud Print.
209 * @param {boolean=} opt_isOpenPdfInPreview Whether to open the PDF in the 205 * @param {boolean=} opt_isOpenPdfInPreview Whether to open the PDF in the
210 * system's preview application. 206 * system's preview application.
211 */ 207 */
212 startPrint: function(destination, printTicketStore, cloudPrintInterface, 208 startPrint: function(destination, printTicketStore, cloudPrintInterface,
213 opt_isOpenPdfInPreview) { 209 opt_isOpenPdfInPreview) {
214 assert(printTicketStore.isTicketValid(), 210 assert(printTicketStore.isTicketValid(),
215 'Trying to print when ticket is not valid'); 211 'Trying to print when ticket is not valid');
216 212
217 var ticket = { 213 var ticket = {
218 'pageRange': printTicketStore.hasPageRangeCapability() ? 214 'pageRange': printTicketStore.getDocumentPageRanges(),
219 printTicketStore.getPageNumberSet().getPageRanges() : [], 215 'pageCount': printTicketStore.getPageNumberSet().size,
Toscano 2013/02/12 01:39:05 Why are we submitting the pageCount now?
220 'landscape': printTicketStore.isLandscapeEnabled(), 216 'landscape': printTicketStore.isLandscapeEnabled(),
221 'color': printTicketStore.isColorEnabled() ? 217 'color': printTicketStore.isColorEnabled() ?
222 NativeLayer.ColorMode_.COLOR : NativeLayer.ColorMode_.GRAY, 218 NativeLayer.ColorMode_.COLOR : NativeLayer.ColorMode_.GRAY,
223 'headerFooterEnabled': printTicketStore.isHeaderFooterEnabled(), 219 'headerFooterEnabled': printTicketStore.isHeaderFooterEnabled(),
224 'marginsType': printTicketStore.getMarginsType(), 220 'marginsType': printTicketStore.getMarginsType(),
225 'generateDraftData': true, // TODO(rltoscano): What should this be? 221 'generateDraftData': true, // TODO(rltoscano): What should this be?
226 'duplex': printTicketStore.isDuplexEnabled() ? 222 'duplex': printTicketStore.isDuplexEnabled() ?
227 NativeLayer.DuplexMode.LONG_EDGE : NativeLayer.DuplexMode.SIMPLEX, 223 NativeLayer.DuplexMode.LONG_EDGE : NativeLayer.DuplexMode.SIMPLEX,
228 'copies': printTicketStore.getCopies(), 224 'copies': printTicketStore.getCopies(),
229 'collate': printTicketStore.isCollateEnabled(), 225 'collate': printTicketStore.isCollateEnabled(),
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 return this.serializedAppStateStr_; 708 return this.serializedAppStateStr_;
713 } 709 }
714 }; 710 };
715 711
716 // Export 712 // Export
717 return { 713 return {
718 NativeInitialSettings: NativeInitialSettings, 714 NativeInitialSettings: NativeInitialSettings,
719 NativeLayer: NativeLayer 715 NativeLayer: NativeLayer
720 }; 716 };
721 }); 717 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698