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

Unified Diff: chrome/browser/resources/print_preview/settings/destination_settings.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: Adjust PrintPreview unit test. 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/settings/destination_settings.js
diff --git a/chrome/browser/resources/print_preview/settings/destination_settings.js b/chrome/browser/resources/print_preview/settings/destination_settings.js
index aa1868190ef0634b872d432c1daf5307751332f6..c901be13f16920f4ac12def7363f72af4ca539a6 100644
--- a/chrome/browser/resources/print_preview/settings/destination_settings.js
+++ b/chrome/browser/resources/print_preview/settings/destination_settings.js
@@ -106,38 +106,42 @@ cr.define('print_preview', function() {
* @private
*/
onDestinationSelect_: function() {
- var destination = this.destinationStore_.selectedDestination;
- var nameEl = this.getElement().getElementsByClassName(
- DestinationSettings.Classes_.NAME)[0];
- nameEl.textContent = destination.displayName;
- nameEl.title = destination.displayName;
-
- var iconEl = this.getElement().getElementsByClassName(
- DestinationSettings.Classes_.ICON)[0];
- iconEl.src = destination.iconUrl;
-
- var hint = destination.hint;
- var locationEl = this.getElement().getElementsByClassName(
- DestinationSettings.Classes_.LOCATION)[0];
- locationEl.textContent = hint;
- locationEl.title = hint;
-
- var offlineStatusText = destination.offlineStatusText;
- var offlineStatusEl =
- this.getChildElement('.destination-settings-offline-status');
- offlineStatusEl.textContent = offlineStatusText;
- offlineStatusEl.title = offlineStatusText;
-
- var isOffline = destination.isOffline;
var destinationSettingsBoxEl =
this.getChildElement('.destination-settings-box');
- destinationSettingsBoxEl.classList.toggle(
- DestinationSettings.Classes_.STALE, isOffline);
- setIsVisible(locationEl, !isOffline);
- setIsVisible(offlineStatusEl, isOffline);
- setIsVisible(this.getChildElement('.throbber-container'), false);
- setIsVisible(destinationSettingsBoxEl, true);
+ var destination = this.destinationStore_.selectedDestination;
+ if (destination != null) {
+ var nameEl = this.getElement().getElementsByClassName(
+ DestinationSettings.Classes_.NAME)[0];
+ nameEl.textContent = destination.displayName;
+ nameEl.title = destination.displayName;
+
+ var iconEl = this.getElement().getElementsByClassName(
+ DestinationSettings.Classes_.ICON)[0];
+ iconEl.src = destination.iconUrl;
+
+ var hint = destination.hint;
+ var locationEl = this.getElement().getElementsByClassName(
+ DestinationSettings.Classes_.LOCATION)[0];
+ locationEl.textContent = hint;
+ locationEl.title = hint;
+
+ var offlineStatusText = destination.offlineStatusText;
+ var offlineStatusEl =
+ this.getChildElement('.destination-settings-offline-status');
+ offlineStatusEl.textContent = offlineStatusText;
+ offlineStatusEl.title = offlineStatusText;
+
+ var isOffline = destination.isOffline;
+ destinationSettingsBoxEl.classList.toggle(
+ DestinationSettings.Classes_.STALE, isOffline);
+ setIsVisible(locationEl, !isOffline);
+ setIsVisible(offlineStatusEl, isOffline);
+ }
+
+ setIsVisible(
+ this.getChildElement('.throbber-container'), destination == null);
+ setIsVisible(destinationSettingsBoxEl, destination != null);
},
onSelectedDestinationNameSet_: function() {
« no previous file with comments | « chrome/browser/resources/print_preview/search/destination_search.js ('k') | chrome/test/data/webui/print_preview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698