| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Modal dialog base component. | 9 * Modal dialog base component. |
| 10 * @param {!print_preview.MetricsContext} metricsContext Metrics | 10 * @param {!print_preview.MetricsContext} metricsContext Metrics |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 /** @return {!print_preview.MetricsContext} */ | 25 /** @return {!print_preview.MetricsContext} */ |
| 26 get metricsContext() { | 26 get metricsContext() { |
| 27 return this.metricsContext_; | 27 return this.metricsContext_; |
| 28 }, | 28 }, |
| 29 | 29 |
| 30 /** @override */ | 30 /** @override */ |
| 31 enterDocument: function() { | 31 enterDocument: function() { |
| 32 print_preview.Component.prototype.enterDocument.call(this); | 32 print_preview.Component.prototype.enterDocument.call(this); |
| 33 | 33 |
| 34 this.getElement().addEventListener('webkitTransitionEnd', function f(e) { | 34 this.getElement().addEventListener('transitionend', function f(e) { |
| 35 if (e.target == e.currentTarget && e.propertyName == 'opacity' && | 35 if (e.target == e.currentTarget && e.propertyName == 'opacity' && |
| 36 e.target.classList.contains('transparent')) { | 36 e.target.classList.contains('transparent')) { |
| 37 setIsVisible(e.target, false); | 37 setIsVisible(e.target, false); |
| 38 } | 38 } |
| 39 }); | 39 }); |
| 40 | 40 |
| 41 this.getElement().addEventListener('keydown', function f(e) { | 41 this.getElement().addEventListener('keydown', function f(e) { |
| 42 // Escape pressed -> cancel the dialog. | 42 // Escape pressed -> cancel the dialog. |
| 43 if (!hasKeyModifiers(e)) { | 43 if (!hasKeyModifiers(e)) { |
| 44 if (e.keyCode == 27) { | 44 if (e.keyCode == 27) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 60 | 60 |
| 61 this.tracker.add( | 61 this.tracker.add( |
| 62 this.getChildElement('.page > .close-button'), | 62 this.getChildElement('.page > .close-button'), |
| 63 'click', | 63 'click', |
| 64 this.cancel.bind(this)); | 64 this.cancel.bind(this)); |
| 65 | 65 |
| 66 this.tracker.add( | 66 this.tracker.add( |
| 67 this.getElement(), 'click', this.onOverlayClick_.bind(this)); | 67 this.getElement(), 'click', this.onOverlayClick_.bind(this)); |
| 68 this.tracker.add( | 68 this.tracker.add( |
| 69 this.getChildElement('.page'), | 69 this.getChildElement('.page'), |
| 70 'webkitAnimationEnd', | 70 'animationend', |
| 71 this.onAnimationEnd_.bind(this)); | 71 this.onAnimationEnd_.bind(this)); |
| 72 }, | 72 }, |
| 73 | 73 |
| 74 /** @return {boolean} Whether the component is visible. */ | 74 /** @return {boolean} Whether the component is visible. */ |
| 75 getIsVisible: function() { | 75 getIsVisible: function() { |
| 76 return !this.getElement().classList.contains('transparent'); | 76 return !this.getElement().classList.contains('transparent'); |
| 77 }, | 77 }, |
| 78 | 78 |
| 79 /** @param {boolean} isVisible Whether the component is visible. */ | 79 /** @param {boolean} isVisible Whether the component is visible. */ |
| 80 setIsVisible: function(isVisible) { | 80 setIsVisible: function(isVisible) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 if (e.target && e.animationName == 'pulse') | 133 if (e.target && e.animationName == 'pulse') |
| 134 e.target.classList.remove('pulse'); | 134 e.target.classList.remove('pulse'); |
| 135 } | 135 } |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 // Export | 138 // Export |
| 139 return { | 139 return { |
| 140 Overlay: Overlay | 140 Overlay: Overlay |
| 141 }; | 141 }; |
| 142 }); | 142 }); |
| OLD | NEW |