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

Unified Diff: chrome/browser/resources/print_preview/search/destination_search.js

Issue 233623003: Remember and restore the account last used destination is registered for. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
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 71f02017b8a7633bc0d70a4f28eebc4b24f117dd..486929ee6fa8c8168b0c26e360134cf11f97bc8f 100644
--- a/chrome/browser/resources/print_preview/search/destination_search.js
+++ b/chrome/browser/resources/print_preview/search/destination_search.js
@@ -147,6 +147,7 @@ cr.define('print_preview', function() {
print_preview.Metrics.DestinationSearchBucket.
CLOUDPRINT_PROMO_SHOWN);
}
+ this.onUsersChanged_();
this.reflowLists_();
} else {
this.getElement().classList.add('transparent');
@@ -224,7 +225,7 @@ cr.define('print_preview', function() {
this.tracker.add(
this.destinationStore_,
print_preview.DestinationStore.EventType.DESTINATION_SEARCH_DONE,
- this.updateThrobbers_.bind(this));
+ this.onDestinationSearchDone_.bind(this));
this.tracker.add(
this.localList_,
@@ -312,7 +313,9 @@ cr.define('print_preview', function() {
var cloudDestinations = [];
var unregisteredCloudDestinations = [];
- this.destinationStore_.destinations.forEach(function(destination) {
+ var destinations =
+ this.destinationStore_.destinations(this.userInfo_.activeUser);
+ destinations.forEach(function(destination) {
if (destination.isRecent) {
recentDestinations.push(destination);
}
@@ -480,7 +483,8 @@ cr.define('print_preview', function() {
* @private
*/
onDestinationStoreSelect_: function() {
- var destinations = this.destinationStore_.destinations;
+ var destinations =
+ this.destinationStore_.destinations(this.userInfo_.activeUser);
var recentDestinations = [];
destinations.forEach(function(destination) {
if (destination.isRecent) {
@@ -502,6 +506,17 @@ cr.define('print_preview', function() {
},
/**
+ * Called when destinations are inserted into the store. Rerenders
+ * destinations.
+ * @private
+ */
+ onDestinationSearchDone_: function() {
+ this.updateThrobbers_();
+ this.renderDestinations_();
+ this.reflowLists_();
+ },
+
+ /**
* Called when the manage cloud printers action is activated.
* @private
*/
@@ -543,6 +558,7 @@ cr.define('print_preview', function() {
accountSelectEl.options[accountSelectEl.selectedIndex].value;
if (account) {
this.userInfo_.activeUser = account;
+ this.destinationStore_.reloadUserCookieBasedDestinations();
} else {
cr.dispatchSimpleEvent(this, DestinationSearch.EventType.ADD_ACCOUNT);
// Set selection back to the active user.

Powered by Google App Engine
This is Rietveld 408576698