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

Side by Side Diff: chrome/browser/resources/print_preview/data/ticket_items/scaling.js

Issue 2617663002: WIP: run clang-format-js on lots of things (Closed)
Patch Set: merge Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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.ticket_items', function() { 5 cr.define('print_preview.ticket_items', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Scaling ticket item whose value is a {@code string} that indicates what the 9 * Scaling ticket item whose value is a {@code string} that indicates what the
10 * scaling (in percent) of the document should be. The ticket item is backed 10 * scaling (in percent) of the document should be. The ticket item is backed
11 * by a string since the user can textually input the scaling value. 11 * by a string since the user can textually input the scaling value.
12 * @param {!print_preview.AppState} appState App state to persist item value. 12 * @param {!print_preview.AppState} appState App state to persist item value.
13 * @param {!print_preview.DocumentInfo} documentInfo Information about the 13 * @param {!print_preview.DocumentInfo} documentInfo Information about the
14 * document to print. 14 * document to print.
15 * @param {!print_preview.DestinationStore} destinationStore Used to determine 15 * @param {!print_preview.DestinationStore} destinationStore Used to determine
16 * whether fit to page should be available. 16 * whether fit to page should be available.
17 * @constructor 17 * @constructor
18 * @extends {print_preview.ticket_items.TicketItem} 18 * @extends {print_preview.ticket_items.TicketItem}
19 */ 19 */
20 function Scaling(appState, destinationStore, documentInfo) { 20 function Scaling(appState, destinationStore, documentInfo) {
21 print_preview.ticket_items.TicketItem.call( 21 print_preview.ticket_items.TicketItem.call(
22 this, 22 this, appState, print_preview.AppState.Field.SCALING, destinationStore,
23 appState,
24 print_preview.AppState.Field.SCALING,
25 destinationStore,
26 documentInfo); 23 documentInfo);
27 }; 24 };
28 25
29 /** 26 /**
30 * Maximum scaling percentage 27 * Maximum scaling percentage
31 * @private {number} 28 * @private {number}
32 * @const 29 * @const
33 */ 30 */
34 Scaling.MAX_VAL = 200; 31 Scaling.MAX_VAL = 200;
35 32
(...skipping 29 matching lines...) Expand all
65 return Math.min(Math.max(value, Scaling.MIN_VAL), Scaling.MAX_VAL); 62 return Math.min(Math.max(value, Scaling.MIN_VAL), Scaling.MAX_VAL);
66 }, 63 },
67 64
68 /** @override */ 65 /** @override */
69 isCapabilityAvailable: function() { 66 isCapabilityAvailable: function() {
70 // This is not a function of the printer, but should be disabled if we are 67 // This is not a function of the printer, but should be disabled if we are
71 // saving a PDF to a PDF. 68 // saving a PDF to a PDF.
72 var knownSizeToSaveAsPdf = 69 var knownSizeToSaveAsPdf =
73 (!this.getDocumentInfoInternal().isModifiable || 70 (!this.getDocumentInfoInternal().isModifiable ||
74 this.getDocumentInfoInternal().hasCssMediaStyles) && 71 this.getDocumentInfoInternal().hasCssMediaStyles) &&
75 this.getSelectedDestInternal() && 72 this.getSelectedDestInternal() &&
76 this.getSelectedDestInternal().id == 73 this.getSelectedDestInternal().id ==
77 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF; 74 print_preview.Destination.GooglePromotedId.SAVE_AS_PDF;
78 return !knownSizeToSaveAsPdf; 75 return !knownSizeToSaveAsPdf;
79 }, 76 },
80 77
81 /** @return {number} The scaling percentage indicated by the ticket item. */ 78 /** @return {number} The scaling percentage indicated by the ticket item. */
82 getValueAsNumber: function() { 79 getValueAsNumber: function() {
83 return parseInt(this.getValue(), 10); 80 return parseInt(this.getValue(), 10);
84 }, 81 },
85 82
86 /** @override */ 83 /** @override */
87 getDefaultValueInternal: function() { 84 getDefaultValueInternal: function() {
88 return '100'; 85 return '100';
89 }, 86 },
90 87
91 /** @override */ 88 /** @override */
92 getCapabilityNotAvailableValueInternal: function() { 89 getCapabilityNotAvailableValueInternal: function() {
93 return '100'; 90 return '100';
94 }, 91 },
95 }; 92 };
96 93
97 // Export 94 // Export
98 return { 95 return {Scaling: Scaling};
99 Scaling: Scaling
100 };
101 }); 96 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698