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

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

Issue 321703002: Revert of Generalize printer color model handling, get rid of CUPS specific case. Enable supported paper szes… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/data/ticket_items/color.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 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 // TODO(rltoscano): Maybe clear print ticket when destination changes. Or 8 // TODO(rltoscano): Maybe clear print ticket when destination changes. Or
9 // better yet, carry over any print ticket state that is possible. I.e. if 9 // better yet, carry over any print ticket state that is possible. I.e. if
10 // destination changes, the new destination might not support duplex anymore, 10 // destination changes, the new destination might not support duplex anymore,
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 'Trying to create a Google Cloud Print print ticket for a ' + 369 'Trying to create a Google Cloud Print print ticket for a ' +
370 'destination with no print capabilities'); 370 'destination with no print capabilities');
371 var cjt = { 371 var cjt = {
372 version: '1.0', 372 version: '1.0',
373 print: {} 373 print: {}
374 }; 374 };
375 if (this.collate.isCapabilityAvailable() && this.collate.isUserEdited()) { 375 if (this.collate.isCapabilityAvailable() && this.collate.isUserEdited()) {
376 cjt.print.collate = {collate: this.collate.getValue()}; 376 cjt.print.collate = {collate: this.collate.getValue()};
377 } 377 }
378 if (this.color.isCapabilityAvailable() && this.color.isUserEdited()) { 378 if (this.color.isCapabilityAvailable() && this.color.isUserEdited()) {
379 var selectedOption = this.color.getSelectedOption(); 379 var colorType = this.color.getValue() ?
380 if (!selectedOption) { 380 'STANDARD_COLOR' : 'STANDARD_MONOCHROME';
381 // Find option with this colorType to read its vendor_id.
382 var selectedOptions = destination.capabilities.printer.color.option.
383 filter(function(option) {
384 return option.type == colorType;
385 });
386 if (selectedOptions.length == 0) {
381 console.error('Could not find correct color option'); 387 console.error('Could not find correct color option');
382 } else { 388 } else {
383 cjt.print.color = {type: selectedOption.type}; 389 cjt.print.color = {type: colorType};
384 if (selectedOption.hasOwnProperty('vendor_id')) { 390 if (selectedOptions[0].hasOwnProperty('vendor_id')) {
385 cjt.print.color.vendor_id = selectedOption.vendor_id; 391 cjt.print.color.vendor_id = selectedOptions[0].vendor_id;
386 } 392 }
387 } 393 }
388 } 394 }
389 if (this.copies.isCapabilityAvailable() && this.copies.isUserEdited()) { 395 if (this.copies.isCapabilityAvailable() && this.copies.isUserEdited()) {
390 cjt.print.copies = {copies: this.copies.getValueAsNumber()}; 396 cjt.print.copies = {copies: this.copies.getValueAsNumber()};
391 } 397 }
392 if (this.duplex.isCapabilityAvailable() && this.duplex.isUserEdited()) { 398 if (this.duplex.isCapabilityAvailable() && this.duplex.isUserEdited()) {
393 cjt.print.duplex = 399 cjt.print.duplex =
394 {type: this.duplex.getValue() ? 'LONG_EDGE' : 'NO_DUPLEX'}; 400 {type: this.duplex.getValue() ? 'LONG_EDGE' : 'NO_DUPLEX'};
395 } 401 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 onDocumentInfoChange_: function() { 489 onDocumentInfoChange_: function() {
484 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE); 490 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE);
485 }, 491 },
486 }; 492 };
487 493
488 // Export 494 // Export
489 return { 495 return {
490 PrintTicketStore: PrintTicketStore 496 PrintTicketStore: PrintTicketStore
491 }; 497 };
492 }); 498 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/data/ticket_items/color.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698