OLD | NEW |
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', function() { | 5 cr.define('print_preview', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * Data model which contains information related to the document to print. | 9 * Data model which contains information related to the document to print. |
10 * @constructor | 10 * @constructor |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 * Number of pages in the document to print. | 52 * Number of pages in the document to print. |
53 * @type {number} | 53 * @type {number} |
54 * @private | 54 * @private |
55 */ | 55 */ |
56 this.pageCount_ = 0; | 56 this.pageCount_ = 0; |
57 | 57 |
58 // Create the document info with some initial settings. Actual | 58 // Create the document info with some initial settings. Actual |
59 // page-related information won't be set until preview generation occurs, | 59 // page-related information won't be set until preview generation occurs, |
60 // so we'll use some defaults until then. This way, the print ticket store | 60 // so we'll use some defaults until then. This way, the print ticket store |
61 // will be valid even if no preview can be generated. | 61 // will be valid even if no preview can be generated. |
62 var initialPageSize = new print_preview.Size(612, 792); // 8.5"x11" | 62 var initialPageSize = new print_preview.Size(612, 792); // 8.5"x11" |
63 | 63 |
64 /** | 64 /** |
65 * Size of the pages of the document in points. | 65 * Size of the pages of the document in points. |
66 * @type {!print_preview.Size} | 66 * @type {!print_preview.Size} |
67 * @private | 67 * @private |
68 */ | 68 */ |
69 this.pageSize_ = initialPageSize; | 69 this.pageSize_ = initialPageSize; |
70 | 70 |
71 /** | 71 /** |
72 * Printable area of the document in points. | 72 * Printable area of the document in points. |
(...skipping 15 matching lines...) Expand all Loading... |
88 * @type {boolean} | 88 * @type {boolean} |
89 * @private | 89 * @private |
90 */ | 90 */ |
91 this.isInitialized_ = false; | 91 this.isInitialized_ = false; |
92 } | 92 } |
93 | 93 |
94 /** | 94 /** |
95 * Event types dispatched by this data model. | 95 * Event types dispatched by this data model. |
96 * @enum {string} | 96 * @enum {string} |
97 */ | 97 */ |
98 DocumentInfo.EventType = { | 98 DocumentInfo.EventType = {CHANGE: 'print_preview.DocumentInfo.CHANGE'}; |
99 CHANGE: 'print_preview.DocumentInfo.CHANGE' | |
100 }; | |
101 | 99 |
102 DocumentInfo.prototype = { | 100 DocumentInfo.prototype = { |
103 __proto__: cr.EventTarget.prototype, | 101 __proto__: cr.EventTarget.prototype, |
104 | 102 |
105 /** @return {boolean} Whether the document is styled by CSS media styles. */ | 103 /** @return {boolean} Whether the document is styled by CSS media styles. */ |
106 get hasCssMediaStyles() { | 104 get hasCssMediaStyles() { |
107 return this.hasCssMediaStyles_; | 105 return this.hasCssMediaStyles_; |
108 }, | 106 }, |
109 | 107 |
110 /** @return {boolean} Whether the document has selected content. */ | 108 /** @return {boolean} Whether the document has selected content. */ |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 this.printableArea_ = printableArea; | 214 this.printableArea_ = printableArea; |
217 this.pageSize_ = pageSize; | 215 this.pageSize_ = pageSize; |
218 this.hasCssMediaStyles_ = hasCssMediaStyles; | 216 this.hasCssMediaStyles_ = hasCssMediaStyles; |
219 this.margins_ = margins; | 217 this.margins_ = margins; |
220 cr.dispatchSimpleEvent(this, DocumentInfo.EventType.CHANGE); | 218 cr.dispatchSimpleEvent(this, DocumentInfo.EventType.CHANGE); |
221 } | 219 } |
222 } | 220 } |
223 }; | 221 }; |
224 | 222 |
225 // Export | 223 // Export |
226 return { | 224 return {DocumentInfo: DocumentInfo}; |
227 DocumentInfo: DocumentInfo | |
228 }; | |
229 }); | 225 }); |
OLD | NEW |