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

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

Issue 477133004: Printe Preview: add 'More/less options' button and make non-essential sections collapsible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Print Preview UI tests adjusted. Created 6 years, 4 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/advanced_options_settings.js
diff --git a/chrome/browser/resources/print_preview/settings/advanced_options_settings.js b/chrome/browser/resources/print_preview/settings/advanced_options_settings.js
index dbef422c17eb764009d54bb616acc4f306f1c805..0d8e639ff81b509c4d29c48c48531aaa6efc7db5 100644
--- a/chrome/browser/resources/print_preview/settings/advanced_options_settings.js
+++ b/chrome/browser/resources/print_preview/settings/advanced_options_settings.js
@@ -10,10 +10,10 @@ cr.define('print_preview', function() {
* @param {!print_preview.DestinationStore} destinationStore Used to determine
* the selected destination.
* @constructor
- * @extends {print_preview.Component}
+ * @extends {print_preview.SettingsSection}
*/
function AdvancedOptionsSettings(destinationStore) {
- print_preview.Component.call(this);
+ print_preview.SettingsSection.call(this);
/**
* Used to determine the selected destination.
@@ -31,7 +31,23 @@ cr.define('print_preview', function() {
};
AdvancedOptionsSettings.prototype = {
- __proto__: print_preview.Component.prototype,
+ __proto__: print_preview.SettingsSection.prototype,
+
+ /** @override */
+ isAvailable: function() {
+ var destination = this.destinationStore_.selectedDestination;
+ var vendorCapabilities =
+ destination &&
+ destination.capabilities &&
+ destination.capabilities.printer &&
+ destination.capabilities.printer.vendor_capability;
+ return false && !!vendorCapabilities;
+ },
+
+ /** @override */
+ hasCollapsibleContent: function() {
+ return this.isAvailable();
+ },
/** @param {boolean} Whether the component is enabled. */
set isEnabled(isEnabled) {
@@ -40,9 +56,7 @@ cr.define('print_preview', function() {
/** @override */
enterDocument: function() {
- print_preview.Component.prototype.enterDocument.call(this);
-
- fadeOutOption(this.getElement(), true);
+ print_preview.SettingsSection.prototype.enterDocument.call(this);
this.tracker.add(
this.getButton_(), 'click', function() {
@@ -52,12 +66,12 @@ cr.define('print_preview', function() {
this.tracker.add(
this.destinationStore_,
print_preview.DestinationStore.EventType.DESTINATION_SELECT,
- this.onDestinationSelect_.bind(this));
+ this.onDestinationChanged_.bind(this));
this.tracker.add(
this.destinationStore_,
print_preview.DestinationStore.EventType.
SELECTED_DESTINATION_CAPABILITIES_READY,
- this.onDestinationSelect_.bind(this));
+ this.onDestinationChanged_.bind(this));
},
/**
@@ -72,18 +86,8 @@ cr.define('print_preview', function() {
* Called when the destination selection has changed. Updates UI elements.
* @private
*/
- onDestinationSelect_: function() {
- var destination = this.destinationStore_.selectedDestination;
- var vendorCapabilities =
- destination &&
- destination.capabilities &&
- destination.capabilities.printer &&
- destination.capabilities.printer.vendor_capability;
- if (false && vendorCapabilities) {
- fadeInOption(this.getElement());
- } else {
- fadeOutOption(this.getElement());
- }
+ onDestinationChanged_: function() {
+ this.updateUiStateInternal();
}
};

Powered by Google App Engine
This is Rietveld 408576698