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

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

Issue 2935303003: Print Preview: Remove global onPrivetPrintFailed (Closed)
Patch Set: Fix annotations Created 3 years, 6 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', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Class that represents a UI component. 9 * Class that represents a UI component.
10 * @constructor 10 * @constructor
11 * @extends {cr.EventTarget} 11 * @extends {cr.EventTarget}
12 */ 12 */
13 function Component() { 13 function Component() {
14 cr.EventTarget.call(this); 14 cr.EventTarget.call(this);
15 15
16 /** 16 /**
17 * Component's HTML element. 17 * Component's HTML element.
18 * @type {Element} 18 * @private {Element}
19 * @private
20 */ 19 */
21 this.element_ = null; 20 this.element_ = null;
22 21
23 this.isInDocument_ = false; 22 this.isInDocument_ = false;
24 23
25 /** 24 /**
26 * Component's event tracker. 25 * Component's event tracker.
27 * @type {EventTracker} 26 * @private {!EventTracker}
28 * @private
29 */ 27 */
30 this.tracker_ = new EventTracker(); 28 this.tracker_ = new EventTracker();
31 29
32 /** 30 /**
31 * Component's WebUI listener tracker.
32 * @private {!WebUIListenerTracker}
33 */
34 this.listenerTracker_ = new WebUIListenerTracker();
35
36 /**
33 * Child components of the component. 37 * Child components of the component.
34 * @type {!Array<!print_preview.Component>} 38 * @private {!Array<!print_preview.Component>}
35 * @private
36 */ 39 */
37 this.children_ = []; 40 this.children_ = [];
38 } 41 }
39 42
40 Component.prototype = { 43 Component.prototype = {
41 __proto__: cr.EventTarget.prototype, 44 __proto__: cr.EventTarget.prototype,
42 45
43 /** Gets the component's element. */ 46 /** Gets the component's element. */
44 getElement: function() { 47 getElement: function() {
45 return this.element_; 48 return this.element_;
46 }, 49 },
47 50
48 /** @return {EventTracker} Component's event tracker. */ 51 /** @return {!EventTracker} Component's event tracker. */
49 get tracker() { 52 get tracker() {
50 return this.tracker_; 53 return this.tracker_;
51 }, 54 },
52 55
56 /** @return {!WebUIListenerTracker} Component's Web UI listener tracker. */
57 get listenerTracker() {
58 return this.listenerTracker_;
59 },
60
53 /** 61 /**
54 * @return {boolean} Whether the element of the component is already in the 62 * @return {boolean} Whether the element of the component is already in the
55 * HTML document. 63 * HTML document.
56 */ 64 */
57 get isInDocument() { 65 get isInDocument() {
58 return this.isInDocument_; 66 return this.isInDocument_;
59 }, 67 },
60 68
61 /** 69 /**
62 * Creates the root element of the component. Sub-classes should override 70 * Creates the root element of the component. Sub-classes should override
(...skipping 18 matching lines...) Expand all
81 }, 89 },
82 90
83 /** Removes all event listeners. */ 91 /** Removes all event listeners. */
84 exitDocument: function() { 92 exitDocument: function() {
85 this.children_.forEach(function(child) { 93 this.children_.forEach(function(child) {
86 if (child.isInDocument) { 94 if (child.isInDocument) {
87 child.exitDocument(); 95 child.exitDocument();
88 } 96 }
89 }); 97 });
90 this.tracker_.removeAll(); 98 this.tracker_.removeAll();
99 this.listenerTracker_.removeAll();
91 this.isInDocument_ = false; 100 this.isInDocument_ = false;
92 }, 101 },
93 102
94 /** 103 /**
95 * Renders this UI component and appends the element to the given parent 104 * Renders this UI component and appends the element to the given parent
96 * element. 105 * element.
97 * @param {!Element} parentElement Element to render the component's 106 * @param {!Element} parentElement Element to render the component's
98 * element into. 107 * element into.
99 */ 108 */
100 render: function(parentElement) { 109 render: function(parentElement) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 setIsVisible(el, true); 211 setIsVisible(el, true);
203 } 212 }
204 return el; 213 return el;
205 } 214 }
206 }; 215 };
207 216
208 return { 217 return {
209 Component: Component 218 Component: Component
210 }; 219 };
211 }); 220 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698