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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 this.selectDestination(this.destinations_[0]); | 244 this.selectDestination(this.destinations_[0]); |
| 245 } else { | 245 } else { |
| 246 var key = this.getDestinationKey_(this.initialDestinationOrigin_, | 246 var key = this.getDestinationKey_(this.initialDestinationOrigin_, |
| 247 this.initialDestinationId_); | 247 this.initialDestinationId_); |
| 248 var candidate = this.destinationMap_[key]; | 248 var candidate = this.destinationMap_[key]; |
| 249 if (candidate != null) { | 249 if (candidate != null) { |
| 250 this.selectDestination(candidate); | 250 this.selectDestination(candidate); |
| 251 } else if (!cr.isChromeOS && | 251 } else if (!cr.isChromeOS && |
| 252 this.initialDestinationOrigin_ == | 252 this.initialDestinationOrigin_ == |
| 253 print_preview.Destination.Origin.LOCAL) { | 253 print_preview.Destination.Origin.LOCAL) { |
| 254 this.nativeLayer_.startGetLocalDestinationCapabilities( | 254 this.nativeLayer_.startGetLocalDestinationCapabilities( |
|
Vitaly Buka (NO REVIEWS)
2013/11/06 07:45:51
Here you need to get caps for selected privet prin
Noam Samuel
2013/11/06 18:43:55
Will do in separate CL so that this and the sticky
Vitaly Buka (NO REVIEWS)
2013/11/06 18:45:32
ok
On 2013/11/06 18:43:55, Noam Samuel wrote:
| |
| 255 this.initialDestinationId_); | 255 this.initialDestinationId_); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 }, | 258 }, |
| 259 | 259 |
| 260 /** | 260 /** |
| 261 * Sets the destination store's Google Cloud Print interface. | 261 * Sets the destination store's Google Cloud Print interface. |
| 262 * @param {!print_preview.CloudPrintInterface} cloudPrintInterface Interface | 262 * @param {!print_preview.CloudPrintInterface} cloudPrintInterface Interface |
| 263 * to set. | 263 * to set. |
| 264 */ | 264 */ |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 664 * Called when capabilities for a privet printer are set. | 664 * Called when capabilities for a privet printer are set. |
| 665 * @param {object} event Contains the capabilities and printer ID. | 665 * @param {object} event Contains the capabilities and printer ID. |
| 666 * @private | 666 * @private |
| 667 */ | 667 */ |
| 668 onPrivetCapabilitiesSet_: function(event) { | 668 onPrivetCapabilitiesSet_: function(event) { |
| 669 var destinationId = event.printerId; | 669 var destinationId = event.printerId; |
| 670 var dest = print_preview.PrivetDestinationParser.parse(event.printer); | 670 var dest = print_preview.PrivetDestinationParser.parse(event.printer); |
| 671 dest.capabilities = event.capabilities; | 671 dest.capabilities = event.capabilities; |
| 672 | 672 |
| 673 this.updateDestination(dest); | 673 this.updateDestination(dest); |
| 674 if (this.selectedDestination_ == dest) { | 674 if (this.selectedDestination_.isPrivet && |
| 675 this.selectedDestination_.id == dest.id) { | |
| 675 cr.dispatchSimpleEvent( | 676 cr.dispatchSimpleEvent( |
| 676 this, | 677 this, |
| 677 DestinationStore.EventType.SELECTED_DESTINATION_CAPABILITIES_READY); | 678 DestinationStore.EventType.SELECTED_DESTINATION_CAPABILITIES_READY); |
| 678 } | 679 } |
| 679 }, | 680 }, |
| 680 | 681 |
| 681 /** | 682 /** |
| 682 * Called when the search for Privet printers is done. | 683 * Called when the search for Privet printers is done. |
| 683 * @private | 684 * @private |
| 684 */ | 685 */ |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 748 return id == this.initialDestinationId_ && | 749 return id == this.initialDestinationId_ && |
| 749 origin == this.initialDestinationOrigin_; | 750 origin == this.initialDestinationOrigin_; |
| 750 } | 751 } |
| 751 }; | 752 }; |
| 752 | 753 |
| 753 // Export | 754 // Export |
| 754 return { | 755 return { |
| 755 DestinationStore: DestinationStore | 756 DestinationStore: DestinationStore |
| 756 }; | 757 }; |
| 757 }); | 758 }); |
| OLD | NEW |