| Index: chrome/browser/resources/print_preview/search/destination_search.js
|
| diff --git a/chrome/browser/resources/print_preview/search/destination_search.js b/chrome/browser/resources/print_preview/search/destination_search.js
|
| index b14e2dd3128fe0ceeee9d13a036ed9bc63b4f062..afccb8b5cd500b4dc342b91593f59c79d5dc8d0e 100644
|
| --- a/chrome/browser/resources/print_preview/search/destination_search.js
|
| +++ b/chrome/browser/resources/print_preview/search/destination_search.js
|
| @@ -223,7 +223,7 @@ cr.define('print_preview', function() {
|
| this.tracker.add(
|
| this.destinationStore_,
|
| print_preview.DestinationStore.EventType.DESTINATIONS_INSERTED,
|
| - this.onDestinationsInserted_.bind(this));
|
| + this.renderDestinations_.bind(this));
|
| this.tracker.add(
|
| this.destinationStore_,
|
| print_preview.DestinationStore.EventType.DESTINATION_SELECT,
|
| @@ -247,6 +247,9 @@ cr.define('print_preview', function() {
|
| this.userInfo_,
|
| print_preview.UserInfo.EventType.EMAIL_CHANGE,
|
| this.onEmailChange_.bind(this));
|
| +
|
| + // Render any destinations already in the store.
|
| + this.renderDestinations_();
|
| },
|
|
|
| /** @override */
|
| @@ -303,6 +306,29 @@ cr.define('print_preview', function() {
|
| },
|
|
|
| /**
|
| + * Renders all of the destinations in the destination store.
|
| + * @private
|
| + */
|
| + renderDestinations_: function() {
|
| + var recentDestinations = [];
|
| + var localDestinations = [];
|
| + var cloudDestinations = [];
|
| + this.destinationStore_.destinations.forEach(function(destination) {
|
| + if (destination.isRecent) {
|
| + recentDestinations.push(destination);
|
| + }
|
| + if (destination.isLocal) {
|
| + localDestinations.push(destination);
|
| + } else {
|
| + cloudDestinations.push(destination);
|
| + }
|
| + });
|
| + this.recentList_.updateDestinations(recentDestinations);
|
| + this.localList_.updateDestinations(localDestinations);
|
| + this.cloudList_.updateDestinations(cloudDestinations);
|
| + },
|
| +
|
| + /**
|
| * Called when a destination search should be executed. Filters the
|
| * destination lists with the given query.
|
| * @param {cr.Event} evt Contains the search query.
|
| @@ -338,30 +364,6 @@ cr.define('print_preview', function() {
|
| },
|
|
|
| /**
|
| - * Called when destinations are added to the destination store. Refreshes UI
|
| - * with new destinations.
|
| - * @private
|
| - */
|
| - onDestinationsInserted_: function() {
|
| - var recentDestinations = [];
|
| - var localDestinations = [];
|
| - var cloudDestinations = [];
|
| - this.destinationStore_.destinations.forEach(function(destination) {
|
| - if (destination.isRecent) {
|
| - recentDestinations.push(destination);
|
| - }
|
| - if (destination.isLocal) {
|
| - localDestinations.push(destination);
|
| - } else {
|
| - cloudDestinations.push(destination);
|
| - }
|
| - });
|
| - this.recentList_.updateDestinations(recentDestinations);
|
| - this.localList_.updateDestinations(localDestinations);
|
| - this.cloudList_.updateDestinations(cloudDestinations);
|
| - },
|
| -
|
| - /**
|
| * Called when a destination is selected. Selected destination are marked as
|
| * recent, so we have to update our recent destinations list.
|
| * @private
|
|
|