| 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 isTicketValidForPreview: function() { | 379 isTicketValidForPreview: function() { |
| 380 return (!this.marginsType_.isCapabilityAvailable() || | 380 return (!this.marginsType_.isCapabilityAvailable() || |
| 381 !this.marginsType_.isValueEqual( | 381 !this.marginsType_.isValueEqual( |
| 382 print_preview.ticket_items.MarginsType.Value.CUSTOM) || | 382 print_preview.ticket_items.MarginsType.Value.CUSTOM) || |
| 383 this.customMargins_.isValid()); | 383 this.customMargins_.isValid()); |
| 384 }, | 384 }, |
| 385 | 385 |
| 386 /** | 386 /** |
| 387 * Creates an object that represents a Google Cloud Print print ticket. | 387 * Creates an object that represents a Google Cloud Print print ticket. |
| 388 * @param {!print_preview.Destination} destination Destination to print to. | 388 * @param {!print_preview.Destination} destination Destination to print to. |
| 389 * @return {!Object} Google Cloud Print print ticket. | 389 * @return {!string} Google Cloud Print print ticket. |
| 390 */ | 390 */ |
| 391 createPrintTicket: function(destination) { | 391 createPrintTicket: function(destination) { |
| 392 assert(!destination.isLocal || destination.isPrivet, | 392 assert(!destination.isLocal || destination.isPrivet, |
| 393 'Trying to create a Google Cloud Print print ticket for a local ' + | 393 'Trying to create a Google Cloud Print print ticket for a local ' + |
| 394 ' non-privet destination'); | 394 ' non-privet destination'); |
| 395 | 395 |
| 396 assert(destination.capabilities, | 396 assert(destination.capabilities, |
| 397 'Trying to create a Google Cloud Print print ticket for a ' + | 397 'Trying to create a Google Cloud Print print ticket for a ' + |
| 398 'destination with no print capabilities'); | 398 'destination with no print capabilities'); |
| 399 var cjt = { | 399 var cjt = { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 onDocumentInfoChange_: function() { | 529 onDocumentInfoChange_: function() { |
| 530 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE); | 530 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE); |
| 531 }, | 531 }, |
| 532 }; | 532 }; |
| 533 | 533 |
| 534 // Export | 534 // Export |
| 535 return { | 535 return { |
| 536 PrintTicketStore: PrintTicketStore | 536 PrintTicketStore: PrintTicketStore |
| 537 }; | 537 }; |
| 538 }); | 538 }); |
| OLD | NEW |