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

Side by Side Diff: chrome/browser/resources/print_preview/common/overlay.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: 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 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 * @constructor 10 * @constructor
(...skipping 19 matching lines...) Expand all
30 30
31 this.getElement().addEventListener('keydown', function f(e) { 31 this.getElement().addEventListener('keydown', function f(e) {
32 // Escape pressed -> cancel the dialog. 32 // Escape pressed -> cancel the dialog.
33 if (!hasKeyModifiers(e)) { 33 if (!hasKeyModifiers(e)) {
34 if (e.keyCode == 27) { 34 if (e.keyCode == 27) {
35 e.stopPropagation(); 35 e.stopPropagation();
36 e.preventDefault(); 36 e.preventDefault();
37 this.cancel(); 37 this.cancel();
38 } else if (e.keyCode == 13) { 38 } else if (e.keyCode == 13) {
39 var activeElementTag = document.activeElement ? 39 var activeElementTag = document.activeElement ?
40 document.activeElement.tagName.toUpperCase() : ''; 40 document.activeElement.tagName.toUpperCase() :
41 '';
41 if (activeElementTag != 'BUTTON' && activeElementTag != 'SELECT') { 42 if (activeElementTag != 'BUTTON' && activeElementTag != 'SELECT') {
42 if (this.onEnterPressedInternal()) { 43 if (this.onEnterPressedInternal()) {
43 e.stopPropagation(); 44 e.stopPropagation();
44 e.preventDefault(); 45 e.preventDefault();
45 } 46 }
46 } 47 }
47 } 48 }
48 } 49 }
49 }.bind(this)); 50 }.bind(this));
50 51
51 this.tracker.add( 52 this.tracker.add(
52 this.getChildElement('.page > .close-button'), 53 this.getChildElement('.page > .close-button'), 'click',
53 'click',
54 this.cancel.bind(this)); 54 this.cancel.bind(this));
55 55
56 this.tracker.add( 56 this.tracker.add(
57 this.getElement(), 'click', this.onOverlayClick_.bind(this)); 57 this.getElement(), 'click', this.onOverlayClick_.bind(this));
58 this.tracker.add( 58 this.tracker.add(
59 this.getChildElement('.page'), 59 this.getChildElement('.page'), 'animationend',
60 'animationend',
61 this.onAnimationEnd_.bind(this)); 60 this.onAnimationEnd_.bind(this));
62 }, 61 },
63 62
64 /** @return {boolean} Whether the component is visible. */ 63 /** @return {boolean} Whether the component is visible. */
65 getIsVisible: function() { 64 getIsVisible: function() {
66 return !this.getElement().classList.contains('transparent'); 65 return !this.getElement().classList.contains('transparent');
67 }, 66 },
68 67
69 /** @param {boolean} isVisible Whether the component is visible. */ 68 /** @param {boolean} isVisible Whether the component is visible. */
70 setIsVisible: function(isVisible) { 69 setIsVisible: function(isVisible) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 * @param {Event} e Contains the target done animating. 118 * @param {Event} e Contains the target done animating.
120 * @private 119 * @private
121 */ 120 */
122 onAnimationEnd_: function(e) { 121 onAnimationEnd_: function(e) {
123 if (e.target && e.animationName == 'pulse') 122 if (e.target && e.animationName == 'pulse')
124 e.target.classList.remove('pulse'); 123 e.target.classList.remove('pulse');
125 } 124 }
126 }; 125 };
127 126
128 // Export 127 // Export
129 return { 128 return {Overlay: Overlay};
130 Overlay: Overlay
131 };
132 }); 129 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698