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

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

Issue 10108001: Refactor print preview web ui (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolve conflicts Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 cr.define('print_preview.ticket_items', function() {
6 'use strict';
7
8 /**
9 * Page range ticket item whose value is a {@code string} that represents
10 * which pages in the document should be printed.
11 * @param {!print_preview.DocumentInfo} documentInfo Information about the
12 * document to print.
13 * @constructor
14 * @extends {print_preview.ticket_items.TicketItem}
15 */
16 function PageRange(documentInfo) {
17 print_preview.ticket_items.TicketItem.call(this);
18
19 /**
20 * Information about the document to print.
21 * @type {!print_preview.DocumentInfo}
22 * @private
23 */
24 this.documentInfo_ = documentInfo;
25 };
26
27 PageRange.prototype = {
28 __proto__: print_preview.ticket_items.TicketItem.prototype,
29
30 /** @override */
31 wouldValueBeValid: function(value) {
32 return value == '' ||
33 isPageRangeTextValid(value, this.documentInfo_.pageCount);
34 },
35
36 /**
37 * @return {!print_preview.PageNumberSet} Set of page numbers defined by the
38 * page range string.
39 */
40 getPageNumberSet: function() {
41 if (this.isValid()) {
42 return print_preview.PageNumberSet.parse(
43 this.getValue(), this.documentInfo_.pageCount);
44 } else {
45 return print_preview.PageNumberSet.parse(
46 this.getDefaultValueInternal(), this.documentInfo_.pageCount);
47 }
48 },
49
50 /** @override */
51 isCapabilityAvailable: function() {
52 return true;
53 },
54
55 /** @override */
56 getDefaultValueInternal: function() {
57 return '';
58 },
59
60 /** @override */
61 getCapabilityNotAvailableValueInternal: function() {
62 return '';
63 }
64 };
65
66 // Export
67 return {
68 PageRange: PageRange
69 };
70 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698