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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 print_preview.ticket_items.MarginsType.Value.CUSTOM) || | 330 print_preview.ticket_items.MarginsType.Value.CUSTOM) || |
331 this.customMargins_.isValid()); | 331 this.customMargins_.isValid()); |
332 }, | 332 }, |
333 | 333 |
334 /** | 334 /** |
335 * Creates an object that represents a Google Cloud Print print ticket. | 335 * Creates an object that represents a Google Cloud Print print ticket. |
336 * @param {!print_preview.Destination} destination Destination to print to. | 336 * @param {!print_preview.Destination} destination Destination to print to. |
337 * @return {!Object} Google Cloud Print print ticket. | 337 * @return {!Object} Google Cloud Print print ticket. |
338 */ | 338 */ |
339 createPrintTicket: function(destination) { | 339 createPrintTicket: function(destination) { |
340 assert(!destination.isLocal, | 340 assert(!destination.isLocal || destination.isPrivet, |
341 'Trying to create a Google Cloud Print print ticket for a local ' + | 341 'Trying to create a Google Cloud Print print ticket for a local ' + |
342 'destination'); | 342 ' non-privet destination'); |
| 343 |
343 assert(destination.capabilities, | 344 assert(destination.capabilities, |
344 'Trying to create a Google Cloud Print print ticket for a ' + | 345 'Trying to create a Google Cloud Print print ticket for a ' + |
345 'destination with no print capabilities'); | 346 'destination with no print capabilities'); |
346 var cjt = { | 347 var cjt = { |
347 version: '1.0', | 348 version: '1.0', |
348 print: {} | 349 print: {} |
349 }; | 350 }; |
350 if (this.collate.isCapabilityAvailable() && this.collate.isUserEdited()) { | 351 if (this.collate.isCapabilityAvailable() && this.collate.isUserEdited()) { |
351 cjt.print.collate = {collate: this.collate.getValue() == 'true'}; | 352 cjt.print.collate = {collate: this.collate.getValue() == 'true'}; |
352 } | 353 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 onDocumentInfoChange_: function() { | 436 onDocumentInfoChange_: function() { |
436 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE); | 437 cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.DOCUMENT_CHANGE); |
437 }, | 438 }, |
438 }; | 439 }; |
439 | 440 |
440 // Export | 441 // Export |
441 return { | 442 return { |
442 PrintTicketStore: PrintTicketStore | 443 PrintTicketStore: PrintTicketStore |
443 }; | 444 }; |
444 }); | 445 }); |
OLD | NEW |