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 'use strict'; | |
6 | |
7 /** | 5 /** |
8 * @param {Element} container Content container. | 6 * @param {Element} container Content container. |
9 * @constructor | 7 * @constructor |
10 */ | 8 */ |
11 function ErrorBanner(container) { | 9 function ErrorBanner(container) { |
12 this.container_ = container; | 10 this.container_ = container; |
13 this.errorBanner_ = this.container_.querySelector('.error-banner'); | 11 this.errorBanner_ = this.container_.querySelector('.error-banner'); |
14 } | 12 } |
15 | 13 |
16 /** | 14 /** |
17 * Shows an error message. | 15 * Shows an error message. |
18 * @param {string} message Message. | 16 * @param {string} message Message. |
19 */ | 17 */ |
20 ErrorBanner.prototype.show = function(message) { | 18 ErrorBanner.prototype.show = function(message) { |
21 this.errorBanner_.textContent = str(message); | 19 this.errorBanner_.textContent = str(message); |
22 this.container_.setAttribute('error', true); | 20 this.container_.setAttribute('error', true); |
23 }; | 21 }; |
24 | 22 |
25 /** | 23 /** |
26 * Hides an error message. | 24 * Hides an error message. |
27 */ | 25 */ |
28 ErrorBanner.prototype.clear = function() { | 26 ErrorBanner.prototype.clear = function() { |
29 this.container_.removeAttribute('error'); | 27 this.container_.removeAttribute('error'); |
30 }; | 28 }; |
OLD | NEW |