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

Unified Diff: chrome/browser/resources/print_preview/data/print_ticket_store.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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/data/print_ticket_store.js
diff --git a/chrome/browser/resources/print_preview/data/print_ticket_store.js b/chrome/browser/resources/print_preview/data/print_ticket_store.js
index 0b0922aaff1759f601a90f45a8b46a4ad326598e..8b8f16b1ea8ba231f34d144fb53dbd9a2310fde1 100644
--- a/chrome/browser/resources/print_preview/data/print_ticket_store.js
+++ b/chrome/browser/resources/print_preview/data/print_ticket_store.js
@@ -147,11 +147,8 @@ cr.define('print_preview', function() {
* @private
*/
this.mediaSize_ = new print_preview.ticket_items.MediaSize(
- this.appState_,
- this.destinationStore_,
- this.documentInfo_,
- this.marginsType_,
- this.customMargins_);
+ this.appState_, this.destinationStore_, this.documentInfo_,
+ this.marginsType_, this.customMargins_);
/**
* Landscape ticket item.
@@ -159,11 +156,8 @@ cr.define('print_preview', function() {
* @private
*/
this.landscape_ = new print_preview.ticket_items.Landscape(
- this.appState_,
- this.destinationStore_,
- this.documentInfo_,
- this.marginsType_,
- this.customMargins_);
+ this.appState_, this.destinationStore_, this.documentInfo_,
+ this.marginsType_, this.customMargins_);
/**
* Header-footer ticket item.
@@ -171,12 +165,8 @@ cr.define('print_preview', function() {
* @private
*/
this.headerFooter_ = new print_preview.ticket_items.HeaderFooter(
- this.appState_,
- this.documentInfo_,
- this.marginsType_,
- this.customMargins_,
- this.mediaSize_,
- this.landscape_);
+ this.appState_, this.documentInfo_, this.marginsType_,
+ this.customMargins_, this.mediaSize_, this.landscape_);
/**
* Fit-to-page ticket item.
@@ -336,86 +326,83 @@ cr.define('print_preview', function() {
*/
init: function(
thousandsDelimeter, decimalDelimeter, unitType, selectionOnly) {
- this.measurementSystem_.setSystem(thousandsDelimeter, decimalDelimeter,
- unitType);
+ this.measurementSystem_.setSystem(
+ thousandsDelimeter, decimalDelimeter, unitType);
this.selectionOnly_.updateValue(selectionOnly);
// Initialize ticket with user's previous values.
if (this.appState_.hasField(
- print_preview.AppStateField.IS_COLOR_ENABLED)) {
+ print_preview.AppStateField.IS_COLOR_ENABLED)) {
this.color_.updateValue(
- /** @type {!Object} */(this.appState_.getField(
- print_preview.AppStateField.IS_COLOR_ENABLED)));
+ /** @type {!Object} */ (this.appState_.getField(
+ print_preview.AppStateField.IS_COLOR_ENABLED)));
}
if (this.appState_.hasField(print_preview.AppStateField.DPI)) {
this.dpi_.updateValue(
- /** @type {!Object} */(this.appState_.getField(
- print_preview.AppStateField.DPI)));
+ /** @type {!Object} */ (
+ this.appState_.getField(print_preview.AppStateField.DPI)));
}
if (this.appState_.hasField(
- print_preview.AppStateField.IS_DUPLEX_ENABLED)) {
+ print_preview.AppStateField.IS_DUPLEX_ENABLED)) {
this.duplex_.updateValue(
- /** @type {!Object} */(this.appState_.getField(
- print_preview.AppStateField.IS_DUPLEX_ENABLED)));
+ /** @type {!Object} */ (this.appState_.getField(
+ print_preview.AppStateField.IS_DUPLEX_ENABLED)));
}
if (this.appState_.hasField(print_preview.AppStateField.MEDIA_SIZE)) {
this.mediaSize_.updateValue(
- /** @type {!Object} */(this.appState_.getField(
- print_preview.AppStateField.MEDIA_SIZE)));
+ /** @type {!Object} */ (this.appState_.getField(
+ print_preview.AppStateField.MEDIA_SIZE)));
}
if (this.appState_.hasField(
- print_preview.AppStateField.IS_LANDSCAPE_ENABLED)) {
+ print_preview.AppStateField.IS_LANDSCAPE_ENABLED)) {
this.landscape_.updateValue(
- /** @type {!Object} */(this.appState_.getField(
- print_preview.AppStateField.IS_LANDSCAPE_ENABLED)));
+ /** @type {!Object} */ (this.appState_.getField(
+ print_preview.AppStateField.IS_LANDSCAPE_ENABLED)));
}
// Initialize margins after landscape because landscape may reset margins.
if (this.appState_.hasField(print_preview.AppStateField.MARGINS_TYPE)) {
this.marginsType_.updateValue(
- /** @type {!Object} */(this.appState_.getField(
- print_preview.AppStateField.MARGINS_TYPE)));
+ /** @type {!Object} */ (this.appState_.getField(
+ print_preview.AppStateField.MARGINS_TYPE)));
}
- if (this.appState_.hasField(
- print_preview.AppStateField.CUSTOM_MARGINS)) {
+ if (this.appState_.hasField(print_preview.AppStateField.CUSTOM_MARGINS)) {
this.customMargins_.updateValue(
- /** @type {!Object} */(this.appState_.getField(
- print_preview.AppStateField.CUSTOM_MARGINS)));
+ /** @type {!Object} */ (this.appState_.getField(
+ print_preview.AppStateField.CUSTOM_MARGINS)));
}
if (this.appState_.hasField(
- print_preview.AppStateField.IS_HEADER_FOOTER_ENABLED)) {
+ print_preview.AppStateField.IS_HEADER_FOOTER_ENABLED)) {
this.headerFooter_.updateValue(
- /** @type {!Object} */(this.appState_.getField(
- print_preview.AppStateField.IS_HEADER_FOOTER_ENABLED)));
+ /** @type {!Object} */ (this.appState_.getField(
+ print_preview.AppStateField.IS_HEADER_FOOTER_ENABLED)));
}
if (this.appState_.hasField(
- print_preview.AppStateField.IS_COLLATE_ENABLED)) {
+ print_preview.AppStateField.IS_COLLATE_ENABLED)) {
this.collate_.updateValue(
- /** @type {!Object} */(this.appState_.getField(
- print_preview.AppStateField.IS_COLLATE_ENABLED)));
+ /** @type {!Object} */ (this.appState_.getField(
+ print_preview.AppStateField.IS_COLLATE_ENABLED)));
}
if (this.appState_.hasField(
- print_preview.AppStateField.IS_FIT_TO_PAGE_ENABLED)) {
+ print_preview.AppStateField.IS_FIT_TO_PAGE_ENABLED)) {
this.fitToPage_.updateValue(
- /** @type {!Object} */(this.appState_.getField(
- print_preview.AppStateField.IS_FIT_TO_PAGE_ENABLED)));
+ /** @type {!Object} */ (this.appState_.getField(
+ print_preview.AppStateField.IS_FIT_TO_PAGE_ENABLED)));
}
- if (this.appState_.hasField(
- print_preview.AppStateField.SCALING)) {
+ if (this.appState_.hasField(print_preview.AppStateField.SCALING)) {
this.scaling_.updateValue(
- /** @type {!Object} */(this.appState_.getField(
- print_preview.AppStateField.SCALING)));
+ /** @type {!Object} */ (
+ this.appState_.getField(print_preview.AppStateField.SCALING)));
}
if (this.appState_.hasField(
- print_preview.AppStateField.IS_CSS_BACKGROUND_ENABLED)) {
+ print_preview.AppStateField.IS_CSS_BACKGROUND_ENABLED)) {
this.cssBackground_.updateValue(
- /** @type {!Object} */(this.appState_.getField(
- print_preview.AppStateField.IS_CSS_BACKGROUND_ENABLED)));
+ /** @type {!Object} */ (this.appState_.getField(
+ print_preview.AppStateField.IS_CSS_BACKGROUND_ENABLED)));
}
- if (this.appState_.hasField(
- print_preview.AppStateField.VENDOR_OPTIONS)) {
+ if (this.appState_.hasField(print_preview.AppStateField.VENDOR_OPTIONS)) {
this.vendorItems_.updateValue(
- /** @type {!Object<string>} */(this.appState_.getField(
- print_preview.AppStateField.VENDOR_OPTIONS)));
+ /** @type {!Object<string>} */ (this.appState_.getField(
+ print_preview.AppStateField.VENDOR_OPTIONS)));
}
},
@@ -427,15 +414,16 @@ cr.define('print_preview', function() {
return this.isTicketValidForPreview() &&
(!this.copies_.isCapabilityAvailable() || this.copies_.isValid()) &&
(!this.pageRange_.isCapabilityAvailable() ||
- this.pageRange_.isValid());
+ this.pageRange_.isValid());
},
/** @return {boolean} Whether the ticket is valid for preview generation. */
isTicketValidForPreview: function() {
- return (!this.marginsType_.isCapabilityAvailable() ||
- !this.marginsType_.isValueEqual(
- print_preview.ticket_items.MarginsTypeValue.CUSTOM) ||
- this.customMargins_.isValid());
+ return (
+ !this.marginsType_.isCapabilityAvailable() ||
+ !this.marginsType_.isValueEqual(
+ print_preview.ticket_items.MarginsTypeValue.CUSTOM) ||
+ this.customMargins_.isValid());
},
/**
@@ -444,18 +432,17 @@ cr.define('print_preview', function() {
* @return {string} Google Cloud Print print ticket.
*/
createPrintTicket: function(destination) {
- assert(!destination.isLocal ||
- destination.isPrivet || destination.isExtension,
- 'Trying to create a Google Cloud Print print ticket for a local ' +
- ' non-privet and non-extension destination');
-
- assert(destination.capabilities,
- 'Trying to create a Google Cloud Print print ticket for a ' +
- 'destination with no print capabilities');
- var cjt = {
- version: '1.0',
- print: {}
- };
+ assert(
+ !destination.isLocal || destination.isPrivet ||
+ destination.isExtension,
+ 'Trying to create a Google Cloud Print print ticket for a local ' +
+ ' non-privet and non-extension destination');
+
+ assert(
+ destination.capabilities,
+ 'Trying to create a Google Cloud Print print ticket for a ' +
+ 'destination with no print capabilities');
+ var cjt = {version: '1.0', print: {}};
if (this.collate.isCapabilityAvailable() && this.collate.isUserEdited()) {
cjt.print.collate = {collate: this.collate.getValue()};
}
@@ -474,8 +461,9 @@ cr.define('print_preview', function() {
cjt.print.copies = {copies: this.copies.getValueAsNumber()};
}
if (this.duplex.isCapabilityAvailable() && this.duplex.isUserEdited()) {
- cjt.print.duplex =
- {type: this.duplex.getValue() ? 'LONG_EDGE' : 'NO_DUPLEX'};
+ cjt.print.duplex = {
+ type: this.duplex.getValue() ? 'LONG_EDGE' : 'NO_DUPLEX'
+ };
}
if (this.mediaSize.isCapabilityAvailable()) {
var value = this.mediaSize.getValue();
@@ -493,8 +481,9 @@ cr.define('print_preview', function() {
if (this.landscape.hasOption('AUTO'))
cjt.print.page_orientation = {type: 'AUTO'};
} else if (this.landscape.isUserEdited()) {
- cjt.print.page_orientation =
- {type: this.landscape.getValue() ? 'LANDSCAPE' : 'PORTRAIT'};
+ cjt.print.page_orientation = {
+ type: this.landscape.getValue() ? 'LANDSCAPE' : 'PORTRAIT'
+ };
}
if (this.dpi.isCapabilityAvailable()) {
var value = this.dpi.getValue();
@@ -530,14 +519,14 @@ cr.define('print_preview', function() {
this.tracker_.add(
this.destinationStore_,
- print_preview.DestinationStore.EventType.
- SELECTED_DESTINATION_CAPABILITIES_READY,
+ print_preview.DestinationStore.EventType
+ .SELECTED_DESTINATION_CAPABILITIES_READY,
this.onSelectedDestinationCapabilitiesReady_.bind(this));
this.tracker_.add(
this.destinationStore_,
- print_preview.DestinationStore.EventType.
- CACHED_SELECTED_DESTINATION_INFO_READY,
+ print_preview.DestinationStore.EventType
+ .CACHED_SELECTED_DESTINATION_INFO_READY,
this.onSelectedDestinationCapabilitiesReady_.bind(this));
// TODO(rltoscano): Print ticket store shouldn't be re-dispatching these
@@ -545,8 +534,7 @@ cr.define('print_preview', function() {
// for the events from document info instead. Will move this when
// consumers are all migrated.
this.tracker_.add(
- this.documentInfo_,
- print_preview.DocumentInfo.EventType.CHANGE,
+ this.documentInfo_, print_preview.DocumentInfo.EventType.CHANGE,
this.onDocumentInfoChange_.bind(this));
},
@@ -572,8 +560,8 @@ cr.define('print_preview', function() {
* @private
*/
onSelectedDestinationCapabilitiesReady_: function() {
- var caps = assert(
- this.destinationStore_.selectedDestination.capabilities);
+ var caps =
+ assert(this.destinationStore_.selectedDestination.capabilities);
var isFirstUpdate = this.capabilitiesHolder_.get() == null;
this.capabilitiesHolder_.set(caps);
if (isFirstUpdate) {
@@ -596,7 +584,5 @@ cr.define('print_preview', function() {
};
// Export
- return {
- PrintTicketStore: PrintTicketStore
- };
+ return {PrintTicketStore: PrintTicketStore};
});

Powered by Google App Engine
This is Rietveld 408576698