Chromium Code Reviews| 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 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 690 * @param {string | print_preview.DestinationOrigin} origin Destination | 690 * @param {string | print_preview.DestinationOrigin} origin Destination |
| 691 * origin. | 691 * origin. |
| 692 * @param {string} id Destination id. | 692 * @param {string} id Destination id. |
| 693 * @param {string} account User account destination is registered for. | 693 * @param {string} account User account destination is registered for. |
| 694 * @param {string} name Destination display name. | 694 * @param {string} name Destination display name. |
| 695 * @param {?print_preview.Cdd} capabilities Destination capabilities. | 695 * @param {?print_preview.Cdd} capabilities Destination capabilities. |
| 696 * @param {string} extensionId Extension ID associated with this | 696 * @param {string} extensionId Extension ID associated with this |
| 697 * destination. | 697 * destination. |
| 698 * @param {string} extensionName Extension name associated with this | 698 * @param {string} extensionName Extension name associated with this |
| 699 * destination. | 699 * destination. |
| 700 * @private | 700 * @private |
|
dpapad
2017/06/08 01:22:14
This function returns a boolean, but there is no @
rbpotter
2017/06/08 22:45:09
Done. It indicates that fetch has been started. Lo
| |
| 701 */ | 701 */ |
| 702 fetchPreselectedDestination_: function( | 702 fetchPreselectedDestination_: function( |
| 703 origin, id, account, name, capabilities, extensionId, extensionName) { | 703 origin, id, account, name, capabilities, extensionId, extensionName) { |
| 704 this.autoSelectMatchingDestination_ = | 704 this.autoSelectMatchingDestination_ = |
| 705 this.createExactDestinationMatch_(origin, id); | 705 this.createExactDestinationMatch_(origin, id); |
| 706 | 706 |
| 707 if (origin == print_preview.DestinationOrigin.LOCAL || | 707 if (origin == print_preview.DestinationOrigin.LOCAL || |
| 708 origin == print_preview.DestinationOrigin.CROS) { | 708 origin == print_preview.DestinationOrigin.CROS) { |
| 709 this.nativeLayer_.startGetLocalDestinationCapabilities(id); | 709 this.nativeLayer_.startGetLocalDestinationCapabilities(id); |
| 710 return true; | 710 return true; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 728 // Create a fake selectedDestination_ that is not actually in the | 728 // Create a fake selectedDestination_ that is not actually in the |
| 729 // destination store. When the real destination is created, this | 729 // destination store. When the real destination is created, this |
| 730 // destination will be overwritten. | 730 // destination will be overwritten. |
| 731 this.selectedDestination_ = new print_preview.Destination( | 731 this.selectedDestination_ = new print_preview.Destination( |
| 732 id, | 732 id, |
| 733 print_preview.DestinationType.LOCAL, | 733 print_preview.DestinationType.LOCAL, |
| 734 print_preview.DestinationOrigin.PRIVET, | 734 print_preview.DestinationOrigin.PRIVET, |
| 735 name, | 735 name, |
| 736 false /*isRecent*/, | 736 false /*isRecent*/, |
| 737 print_preview.DestinationConnectionStatus.ONLINE); | 737 print_preview.DestinationConnectionStatus.ONLINE); |
| 738 this.selectedDestination_.capabilities = capabilities; | |
| 739 | 738 |
| 740 cr.dispatchSimpleEvent( | 739 if (capabilities) { |
| 741 this, | 740 this.selectedDestination_.capabilities = capabilities; |
| 742 DestinationStore.EventType.CACHED_SELECTED_DESTINATION_INFO_READY); | 741 |
| 742 cr.dispatchSimpleEvent( | |
| 743 this, | |
| 744 DestinationStore.EventType | |
| 745 .CACHED_SELECTED_DESTINATION_INFO_READY); | |
| 746 } | |
| 743 return true; | 747 return true; |
| 744 } | 748 } |
| 745 | 749 |
| 746 if (origin == print_preview.DestinationOrigin.EXTENSION) { | 750 if (origin == print_preview.DestinationOrigin.EXTENSION) { |
| 747 // TODO(tbarzic): Add support for requesting a single extension's | 751 // TODO(tbarzic): Add support for requesting a single extension's |
| 748 // printer list. | 752 // printer list. |
| 749 this.startLoadExtensionDestinations(); | 753 this.startLoadExtensionDestinations(); |
| 750 | 754 |
| 751 this.selectedDestination_ = | 755 this.selectedDestination_ = |
| 752 print_preview.ExtensionDestinationParser.parse({ | 756 print_preview.ExtensionDestinationParser.parse({ |
| (...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1695 return this.getDestinationKey_( | 1699 return this.getDestinationKey_( |
| 1696 destination.origin, destination.id, destination.account); | 1700 destination.origin, destination.id, destination.account); |
| 1697 } | 1701 } |
| 1698 }; | 1702 }; |
| 1699 | 1703 |
| 1700 // Export | 1704 // Export |
| 1701 return { | 1705 return { |
| 1702 DestinationStore: DestinationStore | 1706 DestinationStore: DestinationStore |
| 1703 }; | 1707 }; |
| 1704 }); | 1708 }); |
| OLD | NEW |