| Index: chrome/browser/resources/print_preview/data/measurement_system.js
|
| diff --git a/chrome/browser/resources/print_preview/data/measurement_system.js b/chrome/browser/resources/print_preview/data/measurement_system.js
|
| index 6acab16743f2c10104ba0ed65ec5d057f1e5144b..f661b0c1c48f8597d6bcb97fbde4ef6cf0dcefe7 100644
|
| --- a/chrome/browser/resources/print_preview/data/measurement_system.js
|
| +++ b/chrome/browser/resources/print_preview/data/measurement_system.js
|
| @@ -2,6 +2,17 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +cr.exportPath('print_preview');
|
| +
|
| +/**
|
| + * Enumeration of measurement unit types.
|
| + * @enum {number}
|
| + */
|
| +print_preview.MeasurementSystemUnitType = {
|
| + METRIC: 0, // millimeters
|
| + IMPERIAL: 1 // inches
|
| +};
|
| +
|
| cr.define('print_preview', function() {
|
| 'use strict';
|
|
|
| @@ -10,7 +21,7 @@ cr.define('print_preview', function() {
|
| * measurements into the system's local units (e.g. millimeters, inches).
|
| * @param {string} thousandsDelimeter Delimeter between thousands digits.
|
| * @param {string} decimalDelimeter Delimeter between integers and decimals.
|
| - * @param {!print_preview.MeasurementSystem.UnitType} unitType Measurement
|
| + * @param {!print_preview.MeasurementSystemUnitType} unitType Measurement
|
| * unit type of the system.
|
| * @constructor
|
| */
|
| @@ -18,7 +29,7 @@ cr.define('print_preview', function() {
|
| this.thousandsDelimeter_ = thousandsDelimeter || ',';
|
| this.decimalDelimeter_ = decimalDelimeter || '.';
|
| this.unitType_ = unitType;
|
| - };
|
| + }
|
|
|
| /**
|
| * Parses |numberFormat| and extracts the symbols used for the thousands point
|
| @@ -38,31 +49,26 @@ cr.define('print_preview', function() {
|
| };
|
|
|
| /**
|
| - * Enumeration of measurement unit types.
|
| - * @enum {number}
|
| - */
|
| - MeasurementSystem.UnitType = {
|
| - METRIC: 0, // millimeters
|
| - IMPERIAL: 1 // inches
|
| - };
|
| -
|
| - /**
|
| * Maximum resolution of local unit values.
|
| - * @type {!Object<!print_preview.MeasurementSystem.UnitType, number>}
|
| + * @type {!Object<!print_preview.MeasurementSystemUnitType, number>}
|
| * @private
|
| */
|
| MeasurementSystem.Precision_ = {};
|
| - MeasurementSystem.Precision_[MeasurementSystem.UnitType.METRIC] = 0.5;
|
| - MeasurementSystem.Precision_[MeasurementSystem.UnitType.IMPERIAL] = 0.01;
|
| + MeasurementSystem.Precision_[
|
| + print_preview.MeasurementSystemUnitType.METRIC] = 0.5;
|
| + MeasurementSystem.Precision_[
|
| + print_preview.MeasurementSystemUnitType.IMPERIAL] = 0.01;
|
|
|
| /**
|
| * Maximum number of decimal places to keep for local unit.
|
| - * @type {!Object<!print_preview.MeasurementSystem.UnitType, number>}
|
| + * @type {!Object<!print_preview.MeasurementSystemUnitType, number>}
|
| * @private
|
| */
|
| MeasurementSystem.DecimalPlaces_ = {};
|
| - MeasurementSystem.DecimalPlaces_[MeasurementSystem.UnitType.METRIC] = 1;
|
| - MeasurementSystem.DecimalPlaces_[MeasurementSystem.UnitType.IMPERIAL] = 2;
|
| + MeasurementSystem.DecimalPlaces_[
|
| + print_preview.MeasurementSystemUnitType.METRIC] = 1;
|
| + MeasurementSystem.DecimalPlaces_[
|
| + print_preview.MeasurementSystemUnitType.IMPERIAL] = 2;
|
|
|
| /**
|
| * Number of points per inch.
|
| @@ -83,9 +89,10 @@ cr.define('print_preview', function() {
|
| MeasurementSystem.prototype = {
|
| /** @return {string} The unit type symbol of the measurement system. */
|
| get unitSymbol() {
|
| - if (this.unitType_ == MeasurementSystem.UnitType.METRIC) {
|
| + if (this.unitType_ == print_preview.MeasurementSystemUnitType.METRIC) {
|
| return 'mm';
|
| - } else if (this.unitType_ == MeasurementSystem.UnitType.IMPERIAL) {
|
| + } else if (this.unitType_ ==
|
| + print_preview.MeasurementSystemUnitType.IMPERIAL) {
|
| return '"';
|
| } else {
|
| throw Error('Unit type not supported: ' + this.unitType_);
|
| @@ -132,7 +139,7 @@ cr.define('print_preview', function() {
|
| * @return {number} Value in local units.
|
| */
|
| convertFromPoints: function(pts) {
|
| - if (this.unitType_ == MeasurementSystem.UnitType.METRIC) {
|
| + if (this.unitType_ == print_preview.MeasurementSystemUnitType.METRIC) {
|
| return pts / MeasurementSystem.PTS_PER_MM_;
|
| } else {
|
| return pts / MeasurementSystem.PTS_PER_INCH_;
|
| @@ -144,7 +151,7 @@ cr.define('print_preview', function() {
|
| * @return {number} Value in points.
|
| */
|
| convertToPoints: function(localUnits) {
|
| - if (this.unitType_ == MeasurementSystem.UnitType.METRIC) {
|
| + if (this.unitType_ == print_preview.MeasurementSystemUnitType.METRIC) {
|
| return localUnits * MeasurementSystem.PTS_PER_MM_;
|
| } else {
|
| return localUnits * MeasurementSystem.PTS_PER_INCH_;
|
|
|