Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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('extensions', function() { | 5 cr.define('extensions', function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Clone a template within the extension error template collection. | 9 * Clone a template within the extension error template collection. |
| 10 * @param {string} templateName The class name of the template to clone. | 10 * @param {string} templateName The class name of the template to clone. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 var iconNode = document.createElement('img'); | 107 var iconNode = document.createElement('img'); |
| 108 iconNode.className = 'extension-error-icon'; | 108 iconNode.className = 'extension-error-icon'; |
| 109 // TODO(hcarmona): Populate alt text with a proper description since this | 109 // TODO(hcarmona): Populate alt text with a proper description since this |
| 110 // icon conveys the severity of the error. (info, warning, fatal). | 110 // icon conveys the severity of the error. (info, warning, fatal). |
| 111 iconNode.alt = ''; | 111 iconNode.alt = ''; |
| 112 this.insertBefore(iconNode, this.firstChild); | 112 this.insertBefore(iconNode, this.firstChild); |
| 113 | 113 |
| 114 var messageSpan = this.querySelector('.extension-error-message'); | 114 var messageSpan = this.querySelector('.extension-error-message'); |
| 115 messageSpan.textContent = error.message; | 115 messageSpan.textContent = error.message; |
| 116 | 116 |
| 117 var deleteButton = this.querySelector('.error-delete-button'); | 117 var deleteButton = this.querySelector('.error-delete-button'); |
|
Dan Beam
2015/08/11 00:48:56
^
| |
| 118 deleteButton.addEventListener('click', function(e) { | 118 deleteButton.addEventListener('click', function(e) { |
| 119 this.dispatchEvent( | 119 this.dispatchEvent( |
| 120 new CustomEvent('deleteExtensionError', | 120 new CustomEvent('deleteExtensionError', |
| 121 {bubbles: true, detail: this.error})); | 121 {bubbles: true, detail: this.error})); |
| 122 }.bind(this)); | 122 }.bind(this)); |
| 123 | 123 |
| 124 this.addEventListener('click', function(e) { | 124 this.addEventListener('click', function(e) { |
| 125 if (e.target != deleteButton) | 125 if (e.target != deleteButton) |
| 126 this.requestActive_(); | 126 this.requestActive_(); |
| 127 }.bind(this)); | 127 }.bind(this)); |
| 128 this.addEventListener('keydown', function(e) { | 128 this.addEventListener('keydown', function(e) { |
| 129 if (e.keyIdentifier == 'Enter' && e.target != deleteButton) | 129 if (e.keyIdentifier == 'Enter' && e.target != deleteButton) |
| 130 this.requestActive_(); | 130 this.requestActive_(); |
| 131 }); | 131 }); |
| 132 | 132 |
| 133 this.addFocusableElement(this); | 133 this.addFocusableElement(this); |
| 134 this.addFocusableElement(this.querySelector('.error-delete-button')); | 134 this.addFocusableElement(deleteButton); |
|
hcarmona
2015/08/11 01:39:35
I'm curious how this behaves because |this| and |d
Dan Beam
2015/08/11 01:41:55
Acknowledged.
| |
| 135 }, | 135 }, |
| 136 | 136 |
| 137 /** | 137 /** |
| 138 * Bubble up an event to request to become active. | 138 * Bubble up an event to request to become active. |
| 139 * @private | 139 * @private |
| 140 */ | 140 */ |
| 141 requestActive_: function() { | 141 requestActive_: function() { |
| 142 this.dispatchEvent( | 142 this.dispatchEvent( |
| 143 new CustomEvent('highlightExtensionError', | 143 new CustomEvent('highlightExtensionError', |
| 144 {bubbles: true, detail: this.error})); | 144 {bubbles: true, detail: this.error})); |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 onFocus_: function() { | 375 onFocus_: function() { |
| 376 var activeRow = this.gridBoundary_.querySelector('.focus-row-active'); | 376 var activeRow = this.gridBoundary_.querySelector('.focus-row-active'); |
| 377 activeRow.getEquivalentElement(null).focus(); | 377 activeRow.getEquivalentElement(null).focus(); |
| 378 }, | 378 }, |
| 379 }; | 379 }; |
| 380 | 380 |
| 381 return { | 381 return { |
| 382 ExtensionErrorList: ExtensionErrorList | 382 ExtensionErrorList: ExtensionErrorList |
| 383 }; | 383 }; |
| 384 }); | 384 }); |
| OLD | NEW |