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

Side by Side Diff: chrome/browser/resources/print_preview/margin_settings.js

Issue 8605001: Print Preview: Fixing code style issues reported by gsjlint. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebasing Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Creates a Margins object that holds four margin values. The units in which 9 * Creates a Margins object that holds four margin values. The units in which
10 * the values are expressed can be any numeric value. 10 * the values are expressed can be any numeric value.
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // Group name corresponding to the right margin. 162 // Group name corresponding to the right margin.
163 MarginSettings.RIGHT_GROUP = 'right'; 163 MarginSettings.RIGHT_GROUP = 'right';
164 // Group name corresponding to the bottom margin. 164 // Group name corresponding to the bottom margin.
165 MarginSettings.BOTTOM_GROUP = 'bottom'; 165 MarginSettings.BOTTOM_GROUP = 'bottom';
166 166
167 /** 167 /**
168 * Extracts the number formatting and measurement system for the current 168 * Extracts the number formatting and measurement system for the current
169 * locale. 169 * locale.
170 * @param {string} numberFormat Is the formatted version of a sample number, 170 * @param {string} numberFormat Is the formatted version of a sample number,
171 * sent from the backend. 171 * sent from the backend.
172 * @oaram {number} measurementSystem 0 for SI (aka metric system), 1 for the 172 * @param {number} measurementSystem 0 for SI (aka metric system), 1 for the
173 * system used in the US. Note: Mathces UMeasurementSystem enum in 173 * system used in the US. Note: Mathces UMeasurementSystem enum in
174 * third_party/icu/public/i18n/unicode/ulocdata.h. 174 * third_party/icu/public/i18n/unicode/ulocdata.h.
175 */ 175 */
176 MarginSettings.setNumberFormatAndMeasurementSystem = function( 176 MarginSettings.setNumberFormatAndMeasurementSystem = function(
177 numberFormat, measurementSystem) { 177 numberFormat, measurementSystem) {
178 var regex = /^(\d+)(\.|\,)(\d+)(\.|\,)(\d+)$/; 178 var regex = /^(\d+)(\.|\,)(\d+)(\.|\,)(\d+)$/;
179 var matches = numberFormat.match(regex); 179 var matches = numberFormat.match(regex);
180 MarginSettings.thousandsPoint = matches[2]; 180 MarginSettings.thousandsPoint = matches[2];
181 MarginSettings.decimalPoint = matches[4]; 181 MarginSettings.decimalPoint = matches[4];
182 MarginSettings.useMetricSystem = measurementSystem == 0; 182 MarginSettings.useMetricSystem = measurementSystem == 0;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 221
222 /** 222 /**
223 * Sets the current margin selection to |lastUsedMarginType|. 223 * Sets the current margin selection to |lastUsedMarginType|.
224 * @param {number} lastUsedMarginType An integer value identifying a margin 224 * @param {number} lastUsedMarginType An integer value identifying a margin
225 * type according to MarginType enum in printing/print_job_constants.h. 225 * type according to MarginType enum in printing/print_job_constants.h.
226 * @param {Object} lastUsedCustomMargins The last used custom margins. If 226 * @param {Object} lastUsedCustomMargins The last used custom margins. If
227 * custom margins have not been used before 227 * custom margins have not been used before
228 * |margin{Top|Bottom|Left|Right}| attributes are missing. 228 * |margin{Top|Bottom|Left|Right}| attributes are missing.
229 */ 229 */
230 setLastUsedMargins: function(lastUsedMarginsSettings) { 230 setLastUsedMargins: function(lastUsedMarginsSettings) {
231 var lastUsedMarginsType = lastUsedMarginsSettings['marginsType'] 231 var lastUsedMarginsType = lastUsedMarginsSettings['marginsType'];
232 this.forceMarginsUIOnPDFLoad_ = 232 this.forceMarginsUIOnPDFLoad_ =
233 lastUsedMarginsType == MarginSettings.MARGINS_VALUE_CUSTOM; 233 lastUsedMarginsType == MarginSettings.MARGINS_VALUE_CUSTOM;
234 this.marginList_.selectedIndex = 234 this.marginList_.selectedIndex =
235 this.getMarginOptionIndexByValue_(lastUsedMarginsType); 235 this.getMarginOptionIndexByValue_(lastUsedMarginsType);
236 if (lastUsedMarginsSettings.hasOwnProperty('marginTop') && 236 if (lastUsedMarginsSettings.hasOwnProperty('marginTop') &&
237 lastUsedMarginsSettings.hasOwnProperty('marginBottom') && 237 lastUsedMarginsSettings.hasOwnProperty('marginBottom') &&
238 lastUsedMarginsSettings.hasOwnProperty('marginRight') && 238 lastUsedMarginsSettings.hasOwnProperty('marginRight') &&
239 lastUsedMarginsSettings.hasOwnProperty('marginLeft')) { 239 lastUsedMarginsSettings.hasOwnProperty('marginLeft')) {
240 this.customMargins_ = new Margins(-1, -1, -1 , -1); 240 this.customMargins_ = new Margins(-1, -1, -1 , -1);
241 this.customMargins = lastUsedMarginsSettings; 241 this.customMargins = lastUsedMarginsSettings;
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 this.pageWidth_ = this.currentDefaultPageLayout.pageWidth; 689 this.pageWidth_ = this.currentDefaultPageLayout.pageWidth;
690 this.pageHeight_ = this.currentDefaultPageLayout.pageHeight; 690 this.pageHeight_ = this.currentDefaultPageLayout.pageHeight;
691 } 691 }
692 }; 692 };
693 693
694 return { 694 return {
695 MarginSettings: MarginSettings, 695 MarginSettings: MarginSettings,
696 PageLayout: PageLayout, 696 PageLayout: PageLayout,
697 }; 697 };
698 }); 698 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/print_preview/layout_settings.js ('k') | chrome/browser/resources/print_preview/margin_utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698