| 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 /** | 8 /** |
| 9 * A data store that stores destinations and dispatches events when the data | 9 * A data store that stores destinations and dispatches events when the data |
| 10 * store changes. | 10 * store changes. |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 'ROC_8K': 'ROC 8k', | 502 'ROC_8K': 'ROC 8k', |
| 503 }; | 503 }; |
| 504 | 504 |
| 505 /** | 505 /** |
| 506 * Localizes printer capabilities. | 506 * Localizes printer capabilities. |
| 507 * @param {!Object} capabilities Printer capabilities to localize. | 507 * @param {!Object} capabilities Printer capabilities to localize. |
| 508 * @return {!Object} Localized capabilities. | 508 * @return {!Object} Localized capabilities. |
| 509 * @private | 509 * @private |
| 510 */ | 510 */ |
| 511 DestinationStore.localizeCapabilities_ = function(capabilities) { | 511 DestinationStore.localizeCapabilities_ = function(capabilities) { |
| 512 if (!capabilities.printer) |
| 513 return capabilities; |
| 514 |
| 512 var mediaSize = capabilities.printer.media_size; | 515 var mediaSize = capabilities.printer.media_size; |
| 513 if (!mediaSize) | 516 if (!mediaSize) |
| 514 return capabilities; | 517 return capabilities; |
| 515 | 518 |
| 516 for (var i = 0, media; media = mediaSize.option[i]; i++) { | 519 for (var i = 0, media; media = mediaSize.option[i]; i++) { |
| 517 // No need to patch capabilities with localized names provided. | 520 // No need to patch capabilities with localized names provided. |
| 518 if (!media.custom_display_name_localized) { | 521 if (!media.custom_display_name_localized) { |
| 519 media.custom_display_name = | 522 media.custom_display_name = |
| 520 media.custom_display_name || | 523 media.custom_display_name || |
| 521 DestinationStore.MEDIA_DISPLAY_NAMES_[media.name] || | 524 DestinationStore.MEDIA_DISPLAY_NAMES_[media.name] || |
| (...skipping 16 matching lines...) Expand all Loading... |
| 538 return nameA == nameB ? 0 : (nameA > nameB ? 1 : -1); | 541 return nameA == nameB ? 0 : (nameA > nameB ? 1 : -1); |
| 539 }; | 542 }; |
| 540 | 543 |
| 541 /** | 544 /** |
| 542 * Sort printer media sizes. | 545 * Sort printer media sizes. |
| 543 * @param {!Object} capabilities Printer capabilities to localize. | 546 * @param {!Object} capabilities Printer capabilities to localize. |
| 544 * @return {!Object} Localized capabilities. | 547 * @return {!Object} Localized capabilities. |
| 545 * @private | 548 * @private |
| 546 */ | 549 */ |
| 547 DestinationStore.sortMediaSizes_ = function(capabilities) { | 550 DestinationStore.sortMediaSizes_ = function(capabilities) { |
| 551 if (!capabilities.printer) |
| 552 return capabilities; |
| 553 |
| 548 var mediaSize = capabilities.printer.media_size; | 554 var mediaSize = capabilities.printer.media_size; |
| 549 if (!mediaSize) | 555 if (!mediaSize) |
| 550 return capabilities; | 556 return capabilities; |
| 551 | 557 |
| 552 // For the standard sizes, separate into categories, as seen in the Cloud | 558 // For the standard sizes, separate into categories, as seen in the Cloud |
| 553 // Print CDD guide: | 559 // Print CDD guide: |
| 554 // - North American | 560 // - North American |
| 555 // - Chinese | 561 // - Chinese |
| 556 // - ISO | 562 // - ISO |
| 557 // - Japanese | 563 // - Japanese |
| (...skipping 1180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1738 return this.getDestinationKey_( | 1744 return this.getDestinationKey_( |
| 1739 destination.origin, destination.id, destination.account); | 1745 destination.origin, destination.id, destination.account); |
| 1740 } | 1746 } |
| 1741 }; | 1747 }; |
| 1742 | 1748 |
| 1743 // Export | 1749 // Export |
| 1744 return { | 1750 return { |
| 1745 DestinationStore: DestinationStore | 1751 DestinationStore: DestinationStore |
| 1746 }; | 1752 }; |
| 1747 }); | 1753 }); |
| OLD | NEW |