Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: chrome/browser/resources/print_preview/data/destination_store.js

Issue 2927703004: Print Preview: Check capabilities before sending info ready (Closed)
Patch Set: Add notation Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 * @return {boolean} Whether capabilities fetch was successfully started.
700 * @private 701 * @private
701 */ 702 */
702 fetchPreselectedDestination_: function( 703 fetchPreselectedDestination_: function(
703 origin, id, account, name, capabilities, extensionId, extensionName) { 704 origin, id, account, name, capabilities, extensionId, extensionName) {
704 this.autoSelectMatchingDestination_ = 705 this.autoSelectMatchingDestination_ =
705 this.createExactDestinationMatch_(origin, id); 706 this.createExactDestinationMatch_(origin, id);
706 707
707 if (origin == print_preview.DestinationOrigin.LOCAL || 708 if (origin == print_preview.DestinationOrigin.LOCAL ||
708 origin == print_preview.DestinationOrigin.CROS) { 709 origin == print_preview.DestinationOrigin.CROS) {
709 this.nativeLayer_.startGetLocalDestinationCapabilities(id); 710 this.nativeLayer_.startGetLocalDestinationCapabilities(id);
(...skipping 18 matching lines...) Expand all
728 // Create a fake selectedDestination_ that is not actually in the 729 // Create a fake selectedDestination_ that is not actually in the
729 // destination store. When the real destination is created, this 730 // destination store. When the real destination is created, this
730 // destination will be overwritten. 731 // destination will be overwritten.
731 this.selectedDestination_ = new print_preview.Destination( 732 this.selectedDestination_ = new print_preview.Destination(
732 id, 733 id,
733 print_preview.DestinationType.LOCAL, 734 print_preview.DestinationType.LOCAL,
734 print_preview.DestinationOrigin.PRIVET, 735 print_preview.DestinationOrigin.PRIVET,
735 name, 736 name,
736 false /*isRecent*/, 737 false /*isRecent*/,
737 print_preview.DestinationConnectionStatus.ONLINE); 738 print_preview.DestinationConnectionStatus.ONLINE);
738 this.selectedDestination_.capabilities = capabilities;
739 739
740 cr.dispatchSimpleEvent( 740 if (capabilities) {
741 this, 741 this.selectedDestination_.capabilities = capabilities;
742 DestinationStore.EventType.CACHED_SELECTED_DESTINATION_INFO_READY); 742
743 cr.dispatchSimpleEvent(
744 this,
745 DestinationStore.EventType
746 .CACHED_SELECTED_DESTINATION_INFO_READY);
747 }
743 return true; 748 return true;
744 } 749 }
745 750
746 if (origin == print_preview.DestinationOrigin.EXTENSION) { 751 if (origin == print_preview.DestinationOrigin.EXTENSION) {
747 // TODO(tbarzic): Add support for requesting a single extension's 752 // TODO(tbarzic): Add support for requesting a single extension's
748 // printer list. 753 // printer list.
749 this.startLoadExtensionDestinations(); 754 this.startLoadExtensionDestinations();
750 755
751 this.selectedDestination_ = 756 this.selectedDestination_ =
752 print_preview.ExtensionDestinationParser.parse({ 757 print_preview.ExtensionDestinationParser.parse({
(...skipping 942 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 return this.getDestinationKey_( 1700 return this.getDestinationKey_(
1696 destination.origin, destination.id, destination.account); 1701 destination.origin, destination.id, destination.account);
1697 } 1702 }
1698 }; 1703 };
1699 1704
1700 // Export 1705 // Export
1701 return { 1706 return {
1702 DestinationStore: DestinationStore 1707 DestinationStore: DestinationStore
1703 }; 1708 };
1704 }); 1709 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698