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

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

Issue 575333002: Compile print_preview, part 2: reduce down to 260 errors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@I_print_preview
Patch Set: revert movement of enums: now handle in compiler pass Created 6 years, 2 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * Copies ticket item whose value is a {@code string} that indicates how many 9 * Copies ticket item whose value is a {@code string} that indicates how many
10 * copies of the document should be printed. The ticket item is backed by a 10 * copies of the document should be printed. The ticket item is backed by a
11 * string since the user can textually input the copies value. 11 * string since the user can textually input the copies value.
12 * @param {!print_preview.DestinationStore} destinationStore Destination store 12 * @param {!print_preview.DestinationStore} destinationStore Destination store
13 * used determine if a destination has the copies capability. 13 * used determine if a destination has the copies capability.
14 * @constructor 14 * @constructor
15 * @extends {print_preview.ticket_items.TicketItem} 15 * @extends {print_preview.ticket_items.TicketItem}
16 */ 16 */
17 function Copies(destinationStore) { 17 function Copies(destinationStore) {
18 print_preview.ticket_items.TicketItem.call( 18 print_preview.ticket_items.TicketItem.call(
19 this, null /*appState*/, null /*field*/, destinationStore); 19 this, null /*appState*/, null /*field*/, destinationStore);
20 }; 20 };
21 21
22 Copies.prototype = { 22 Copies.prototype = {
23 __proto__: print_preview.ticket_items.TicketItem.prototype, 23 __proto__: print_preview.ticket_items.TicketItem.prototype,
24 24
25 /** @override */ 25 /** @override */
26 wouldValueBeValid: function(value) { 26 wouldValueBeValid: function(value) {
27 if (/[^\d]+/.test(value)) { 27 if (/[^\d]+/.test(value)) {
28 return false; 28 return false;
29 } 29 }
30 var copies = parseInt(value); 30 var copies = parseInt(value, 10);
31 if (copies > 999 || copies < 1) { 31 if (copies > 999 || copies < 1) {
32 return false; 32 return false;
33 } 33 }
34 return true; 34 return true;
35 }, 35 },
36 36
37 /** @override */ 37 /** @override */
38 isCapabilityAvailable: function() { 38 isCapabilityAvailable: function() {
39 return !!this.getCopiesCapability_(); 39 return !!this.getCopiesCapability_();
40 }, 40 },
41 41
42 /** @return {number} The number of copies indicated by the ticket item. */ 42 /** @return {number} The number of copies indicated by the ticket item. */
43 getValueAsNumber: function() { 43 getValueAsNumber: function() {
44 return parseInt(this.getValue()); 44 return parseInt(this.getValue(), 10);
45 }, 45 },
46 46
47 /** @override */ 47 /** @override */
48 getDefaultValueInternal: function() { 48 getDefaultValueInternal: function() {
49 var cap = this.getCopiesCapability_(); 49 var cap = this.getCopiesCapability_();
50 return cap.hasOwnProperty('default') ? cap.default : '1'; 50 return cap.hasOwnProperty('default') ? cap.default : '1';
51 }, 51 },
52 52
53 /** @override */ 53 /** @override */
54 getCapabilityNotAvailableValueInternal: function() { 54 getCapabilityNotAvailableValueInternal: function() {
(...skipping 12 matching lines...) Expand all
67 dest.capabilities.printer.copies) || 67 dest.capabilities.printer.copies) ||
68 null; 68 null;
69 } 69 }
70 }; 70 };
71 71
72 // Export 72 // Export
73 return { 73 return {
74 Copies: Copies 74 Copies: Copies
75 }; 75 };
76 }); 76 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698