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

Unified Diff: chrome/browser/resources/print_preview/settings/destination_settings.js

Issue 150943006: Show destination offline status in the print preview. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 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() {

Powered by Google App Engine
This is Rietveld 408576698