| OLD | NEW |
| 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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 print_preview.ticket_items.MarginsType.Value.CUSTOM) || | 399 print_preview.ticket_items.MarginsType.Value.CUSTOM) || |
| 400 this.customMargins_.isValid()); | 400 this.customMargins_.isValid()); |
| 401 }, | 401 }, |
| 402 | 402 |
| 403 /** | 403 /** |
| 404 * Creates an object that represents a Google Cloud Print print ticket. | 404 * Creates an object that represents a Google Cloud Print print ticket. |
| 405 * @param {!print_preview.Destination} destination Destination to print to. | 405 * @param {!print_preview.Destination} destination Destination to print to. |
| 406 * @return {!Object} Google Cloud Print print ticket. | 406 * @return {!Object} Google Cloud Print print ticket. |
| 407 */ | 407 */ |
| 408 createPrintTicket: function(destination) { | 408 createPrintTicket: function(destination) { |
| 409 assert(!destination.isLocal || destination.isPrivet, | 409 assert(!destination.isLocal || |
| 410 destination.isPrivet || destination.isExtension, |
| 410 'Trying to create a Google Cloud Print print ticket for a local ' + | 411 'Trying to create a Google Cloud Print print ticket for a local ' + |
| 411 ' non-privet destination'); | 412 ' non-privet and non-extension destination'); |
| 412 | 413 |
| 413 assert(destination.capabilities, | 414 assert(destination.capabilities, |
| 414 'Trying to create a Google Cloud Print print ticket for a ' + | 415 'Trying to create a Google Cloud Print print ticket for a ' + |
| 415 'destination with no print capabilities'); | 416 'destination with no print capabilities'); |
| 416 var cjt = { | 417 var cjt = { |
| 417 version: '1.0', | 418 version: '1.0', |
| 418 print: {} | 419 print: {} |
| 419 }; | 420 }; |
| 420 if (this.collate.isCapabilityAvailable() && this.collate.isUserEdited()) { | 421 if (this.collate.isCapabilityAvailable() && this.collate.isUserEdited()) { |
| 421 cjt.print.collate = {collate: this.collate.getValue()}; | 422 cjt.print.collate = {collate: this.collate.getValue()}; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 onDocumentInfoChange_: function() { | 555 onDocumentInfoChange_: function() { |
| 555 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE); | 556 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE); |
| 556 }, | 557 }, |
| 557 }; | 558 }; |
| 558 | 559 |
| 559 // Export | 560 // Export |
| 560 return { | 561 return { |
| 561 PrintTicketStore: PrintTicketStore | 562 PrintTicketStore: PrintTicketStore |
| 562 }; | 563 }; |
| 563 }); | 564 }); |
| OLD | NEW |