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 9c806fd204eb9dca72f8378d03fc9b77219e3027..e92adb02fb1a4e57a8f0b632ac7439620fcace11 100644 |
--- a/chrome/browser/resources/print_preview/settings/destination_settings.js |
+++ b/chrome/browser/resources/print_preview/settings/destination_settings.js |
@@ -58,7 +58,9 @@ cr.define('print_preview', function() { |
ICON_MOBILE: 'destination-settings-icon-mobile', |
ICON_MOBILE_SHARED: 'destination-settings-icon-mobile-shared', |
LOCATION: 'destination-settings-location', |
+ OFFLINE_STATUS: 'destination-settings-offline-status', |
NAME: 'destination-settings-name', |
+ STALE: 'stale', |
THOBBER_NAME: 'destination-throbber-name' |
}; |
@@ -115,15 +117,34 @@ cr.define('print_preview', function() { |
DestinationSettings.Classes_.ICON)[0]; |
iconEl.src = destination.iconUrl; |
+ var location = destination.location; |
var locationEl = this.getElement().getElementsByClassName( |
DestinationSettings.Classes_.LOCATION)[0]; |
- locationEl.textContent = destination.location; |
- locationEl.title = destination.location; |
+ locationEl.textContent = location; |
+ locationEl.title = location; |
+ |
+ var offlineStatusText = destination.offlineStatusText; |
+ var offlineStatusEl = this.getElement().getElementsByClassName( |
Toscano
2014/02/12 22:10:29
Why not use this.getChildElement()?
Aleksey Shlyapnikov
2014/02/13 19:10:18
Done.
|
+ DestinationSettings.Classes_.OFFLINE_STATUS)[0]; |
+ offlineStatusEl.textContent = offlineStatusText; |
+ offlineStatusEl.title = offlineStatusText; |
+ |
+ var isOffline = destination.isOffline; |
+ var destinationSettingsBoxEl = |
+ this.getElement().querySelector('.destination-settings-box'); |
Toscano
2014/02/12 22:10:29
Why not use this.getChildElement()?
Aleksey Shlyapnikov
2014/02/13 19:10:18
Done.
|
+ if (isOffline) { |
+ destinationSettingsBoxEl.classList.add( |
+ DestinationSettings.Classes_.STALE); |
+ } else { |
+ destinationSettingsBoxEl.classList.remove( |
+ DestinationSettings.Classes_.STALE); |
+ } |
Toscano
2014/02/12 22:10:29
What about simplifying this if-else statement to:
Aleksey Shlyapnikov
2014/02/13 19:10:18
Done.
|
+ setIsVisible(locationEl, !isOffline); |
+ setIsVisible(offlineStatusEl, isOffline); |
setIsVisible(this.getElement().querySelector('.throbber-container'), |
false); |
- setIsVisible( |
- this.getElement().querySelector('.destination-settings-box'), true); |
+ setIsVisible(destinationSettingsBoxEl, true); |
}, |
onSelectedDestinationNameSet_: function() { |