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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 * Localizes printer capabilities. | 335 * Localizes printer capabilities. |
336 * @param {!Object} capabilities Printer capabilities to localize. | 336 * @param {!Object} capabilities Printer capabilities to localize. |
337 * @return {!Object} Localized capabilities. | 337 * @return {!Object} Localized capabilities. |
338 * @private | 338 * @private |
339 */ | 339 */ |
340 DestinationStore.localizeCapabilities_ = function(capabilities) { | 340 DestinationStore.localizeCapabilities_ = function(capabilities) { |
341 var mediaSize = capabilities.printer.media_size; | 341 var mediaSize = capabilities.printer.media_size; |
342 if (!mediaSize) | 342 if (!mediaSize) |
343 return capabilities; | 343 return capabilities; |
344 | 344 |
345 var mediaDisplayNames = { | 345 var mediaDisplayNames = { |
dpapad
2016/10/24 18:14:56
Now that this object got significantly larger, can
Lei Zhang
2016/10/24 19:30:52
Done.
| |
346 'ISO_2A0': '2A0', | |
346 'ISO_A0': 'A0', | 347 'ISO_A0': 'A0', |
348 'ISO_A0X3': 'A0x3', | |
347 'ISO_A1': 'A1', | 349 'ISO_A1': 'A1', |
350 'ISO_A10': 'A10', | |
351 'ISO_A1X3': 'A1x3', | |
352 'ISO_A1X4': 'A1x4', | |
348 'ISO_A2': 'A2', | 353 'ISO_A2': 'A2', |
354 'ISO_A2X3': 'A2x3', | |
355 'ISO_A2X4': 'A2x4', | |
356 'ISO_A2X5': 'A2x5', | |
349 'ISO_A3': 'A3', | 357 'ISO_A3': 'A3', |
358 'ISO_A3X3': 'A3x3', | |
359 'ISO_A3X4': 'A3x4', | |
360 'ISO_A3X5': 'A3x5', | |
361 'ISO_A3X6': 'A3x6', | |
362 'ISO_A3X7': 'A3x7', | |
363 'ISO_A3_EXTRA': 'A3 Extra', | |
350 'ISO_A4': 'A4', | 364 'ISO_A4': 'A4', |
365 'ISO_A4X3': 'A4x3', | |
366 'ISO_A4X4': 'A4x4', | |
367 'ISO_A4X5': 'A4x5', | |
368 'ISO_A4X6': 'A4x6', | |
369 'ISO_A4X7': 'A4x7', | |
370 'ISO_A4X8': 'A4x8', | |
371 'ISO_A4X9': 'A4x9', | |
372 'ISO_A4_EXTRA': 'A4 Extra', | |
373 'ISO_A4_TAB': 'A4 Tab', | |
351 'ISO_A5': 'A5', | 374 'ISO_A5': 'A5', |
375 'ISO_A5_EXTRA': 'A5 Extra', | |
352 'ISO_A6': 'A6', | 376 'ISO_A6': 'A6', |
377 'ISO_A7': 'A7', | |
378 'ISO_A8': 'A8', | |
379 'ISO_A9': 'A9', | |
380 'ISO_B0': 'B0', | |
381 'ISO_B1': 'B1', | |
382 'ISO_B10': 'B10', | |
383 'ISO_B2': 'B2', | |
384 'ISO_B3': 'B3', | |
385 'ISO_B4': 'B4', | |
386 'ISO_B5': 'B5', | |
387 'ISO_B5_EXTRA': 'B5 Extra', | |
388 'ISO_B6': 'B6', | |
389 'ISO_B6C4': 'B6C4', | |
390 'ISO_B7': 'B7', | |
391 'ISO_B8': 'B8', | |
392 'ISO_B9': 'B9', | |
393 'ISO_C0': 'C0', | |
394 'ISO_C1': 'C1', | |
395 'ISO_C10': 'C10', | |
396 'ISO_C2': 'C2', | |
397 'ISO_C3': 'C3', | |
398 'ISO_C4': 'C4', | |
399 'ISO_C5': 'C5', | |
400 'ISO_C6': 'C6', | |
401 'ISO_C6C5': 'C6C5', | |
402 'ISO_C7': 'C7', | |
403 'ISO_C7C6': 'C7C6', | |
404 'ISO_C8': 'C8', | |
405 'ISO_C9': 'C9', | |
406 'ISO_DL': 'Envelope DL', | |
407 'ISO_RA0': 'RA0', | |
408 'ISO_RA1': 'RA1', | |
409 'ISO_RA2': 'RA2', | |
410 'ISO_SRA0': 'SRA0', | |
411 'ISO_SRA1': 'SRA1', | |
412 'ISO_SRA2': 'SRA2', | |
413 'JIS_B0': 'B0 (JIS)', | |
414 'JIS_B1': 'B1 (JIS)', | |
415 'JIS_B10': 'B10 (JIS)', | |
416 'JIS_B2': 'B2 (JIS)', | |
417 'JIS_B3': 'B3 (JIS)', | |
418 'JIS_B4': 'B4 (JIS)', | |
353 'JIS_B5': 'B5 (JIS)', | 419 'JIS_B5': 'B5 (JIS)', |
420 'JIS_B6': 'B6 (JIS)', | |
421 'JIS_B7': 'B7 (JIS)', | |
422 'JIS_B8': 'B8 (JIS)', | |
423 'JIS_B9': 'B9 (JIS)', | |
424 'JIS_EXEC': 'Executive (JIS)', | |
425 'JPN_CHOU2': 'Choukei 2', | |
426 'JPN_CHOU3': 'Choukei 3', | |
427 'JPN_CHOU4': 'Choukei 4', | |
428 'JPN_HAGAKI': 'Hagaki', | |
429 'JPN_KAHU': 'Kahu Envelope', | |
430 'JPN_KAKU2': 'Kaku 2', | |
431 'JPN_OUFUKU': 'Oufuku Hagaki', | |
432 'JPN_YOU4': 'You 4', | |
433 'NA_10X11': '10x11', | |
434 'NA_10X13': '10x13', | |
435 'NA_10X14': '10x14', | |
436 'NA_10X15': '10x15', | |
437 'NA_11X12': '11x12', | |
438 'NA_11X15': '11x15', | |
439 'NA_12X19': '12x19', | |
440 'NA_5X7': '5x7', | |
441 'NA_6X9': '6x9', | |
442 'NA_7X9': '7x9', | |
443 'NA_9X11': '9x11', | |
444 'NA_A2': 'A2', | |
445 'NA_ARCH_A': 'Arch A', | |
446 'NA_ARCH_B': 'Arch B', | |
447 'NA_ARCH_C': 'Arch C', | |
448 'NA_ARCH_D': 'Arch D', | |
449 'NA_ARCH_E': 'Arch E', | |
450 'NA_ASME_F': 'ASME F', | |
451 'NA_B_PLUS': 'B-plus', | |
452 'NA_C': 'C', | |
453 'NA_C5': 'C5', | |
454 'NA_D': 'D', | |
455 'NA_E': 'E', | |
456 'NA_EDP': 'EDP', | |
457 'NA_EUR_EDP': 'European EDP', | |
354 'NA_EXECUTIVE': 'Executive', | 458 'NA_EXECUTIVE': 'Executive', |
459 'NA_F': 'F', | |
460 'NA_FANFOLD_EUR': 'FanFold European', | |
461 'NA_FANFOLD_US': 'FanFold US', | |
462 'NA_FOOLSCAP': 'FanFold German Legal', | |
463 'NA_GOVT_LEGAL': 'Government Legal', | |
464 'NA_GOVT_LETTER': 'Government Letter', | |
465 'NA_INDEX_3X5': 'Index 3x5', | |
466 'NA_INDEX_4X6': 'Index 4x6', | |
467 'NA_INDEX_4X6_EXT': 'Index 4x6 ext', | |
468 'NA_INDEX_5X8': '5x8', | |
469 'NA_INVOICE': 'Invoice', | |
470 'NA_LEDGER': 'Ledger', | |
355 'NA_LEGAL': 'Legal', | 471 'NA_LEGAL': 'Legal', |
472 'NA_LEGAL_EXTRA': 'Legal extra', | |
356 'NA_LETTER': 'Letter', | 473 'NA_LETTER': 'Letter', |
357 'NA_LEDGER': 'Tabloid', | 474 'NA_LETTER_EXTRA': 'Letter extra', |
Lei Zhang
2016/10/22 02:11:06
I asked on https://codereview.chromium.org/2949230
| |
358 'OM_FOLIO': 'Folio' | 475 'NA_LETTER_PLUS': 'Letter plus', |
476 'NA_MONARCH': 'Monarch', | |
477 'NA_NUMBER_10': 'Envelope #10', | |
478 'NA_NUMBER_11': 'Envelope #11', | |
479 'NA_NUMBER_12': 'Envelope #12', | |
480 'NA_NUMBER_14': 'Envelope #14', | |
481 'NA_NUMBER_9': 'Envelope #9', | |
482 'NA_PERSONAL': 'Personal', | |
483 'NA_QUARTO': 'Quarto', | |
484 'NA_SUPER_A': 'Super A', | |
485 'NA_SUPER_B': 'Super B', | |
486 'NA_WIDE_FORMAT': 'Wide format', | |
487 'OM_DAI_PA_KAI': 'Dai-pa-kai', | |
488 'OM_FOLIO': 'Folio', | |
489 'OM_FOLIO_SP': 'Folio SP', | |
490 'OM_INVITE': 'Invite Envelope', | |
491 'OM_ITALIAN': 'Italian Envelope', | |
492 'OM_JUURO_KU_KAI': 'Juuro-ku-kai', | |
493 'OM_LARGE_PHOTO': 'Large photo', | |
494 'OM_OFICIO': 'Oficio' | |
495 'OM_PA_KAI': 'Pa-kai', | |
496 'OM_POSTFIX': 'Postfix Envelope', | |
497 'OM_SMALL_PHOTO': 'Small photo', | |
498 'PRC_1': 'prc1 Envelope', | |
499 'PRC_10': 'prc10 Envelope', | |
500 'PRC_16K': 'prc 16k', | |
501 'PRC_2': 'prc2 Envelope', | |
502 'PRC_3': 'prc3 Envelope', | |
503 'PRC_32K': 'prc 32k', | |
504 'PRC_4': 'prc4 Envelope', | |
505 'PRC_5': 'prc5 Envelope', | |
506 'PRC_6': 'prc6 Envelope', | |
507 'PRC_7': 'prc7 Envelope', | |
508 'PRC_8': 'prc8 Envelope', | |
509 'ROC_16K': 'ROC 16K', | |
510 'ROC_8K': 'ROC 8k' | |
Lei Zhang
2016/10/22 02:11:06
Can I add a trailing comma?
dpapad
2016/10/24 18:14:56
Yes, unless you care about IE6 and such ;>
| |
359 }; | 511 }; |
360 for (var i = 0, media; media = mediaSize.option[i]; i++) { | 512 for (var i = 0, media; media = mediaSize.option[i]; i++) { |
361 // No need to patch capabilities with localized names provided. | 513 // No need to patch capabilities with localized names provided. |
362 if (!media.custom_display_name_localized) { | 514 if (!media.custom_display_name_localized) { |
363 media.custom_display_name = | 515 media.custom_display_name = |
364 media.custom_display_name || | 516 media.custom_display_name || |
365 mediaDisplayNames[media.name] || | 517 mediaDisplayNames[media.name] || |
366 media.name; | 518 media.name; |
367 } | 519 } |
368 } | 520 } |
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1582 return this.getDestinationKey_( | 1734 return this.getDestinationKey_( |
1583 destination.origin, destination.id, destination.account); | 1735 destination.origin, destination.id, destination.account); |
1584 } | 1736 } |
1585 }; | 1737 }; |
1586 | 1738 |
1587 // Export | 1739 // Export |
1588 return { | 1740 return { |
1589 DestinationStore: DestinationStore | 1741 DestinationStore: DestinationStore |
1590 }; | 1742 }; |
1591 }); | 1743 }); |
OLD | NEW |