| 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('options', function() { | 5 cr.define('options', function() { |
| 6 /** @const */ var ControlledSettingIndicator = | 6 /** @const */ var ControlledSettingIndicator = |
| 7 options.ControlledSettingIndicator; | 7 options.ControlledSettingIndicator; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * A variant of the {@link ControlledSettingIndicator} that shows the status | 10 * A variant of the {@link ControlledSettingIndicator} that shows the status |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 ControlledSettingIndicator.prototype.decorate.call(this); | 26 ControlledSettingIndicator.prototype.decorate.call(this); |
| 27 this.hidden = true; | 27 this.hidden = true; |
| 28 }, | 28 }, |
| 29 | 29 |
| 30 /* Handle changes to the associated pref by hiding any currently visible | 30 /* Handle changes to the associated pref by hiding any currently visible |
| 31 * bubble. | 31 * bubble. |
| 32 * @param {Event} event Pref change event. | 32 * @param {Event} event Pref change event. |
| 33 * @override | 33 * @override |
| 34 */ | 34 */ |
| 35 handlePrefChange: function(event) { | 35 handlePrefChange: function(event) { |
| 36 OptionsPage.hideBubble(); | 36 PageManager.hideBubble(); |
| 37 }, | 37 }, |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * Sets the variable tracking thesection which becomes disabled if an | 40 * Sets the variable tracking thesection which becomes disabled if an |
| 41 * error exists. | 41 * error exists. |
| 42 * @param {HTMLElement} section The section to disable. | 42 * @param {HTMLElement} section The section to disable. |
| 43 */ | 43 */ |
| 44 set disabledOnErrorSection(section) { | 44 set disabledOnErrorSection(section) { |
| 45 this.disabledOnErrorSection_ = section; | 45 this.disabledOnErrorSection_ = section; |
| 46 }, | 46 }, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 75 this.disabledOnErrorSection_.disabled = !!this.errorText_; | 75 this.disabledOnErrorSection_.disabled = !!this.errorText_; |
| 76 }, | 76 }, |
| 77 | 77 |
| 78 /** | 78 /** |
| 79 * Toggles showing and hiding the error message bubble. An empty | 79 * Toggles showing and hiding the error message bubble. An empty |
| 80 * |errorText_| indicates that there is no error message. So the bubble | 80 * |errorText_| indicates that there is no error message. So the bubble |
| 81 * only be shown if |errorText_| has a value. | 81 * only be shown if |errorText_| has a value. |
| 82 */ | 82 */ |
| 83 toggleBubble_: function() { | 83 toggleBubble_: function() { |
| 84 if (this.showingBubble) { | 84 if (this.showingBubble) { |
| 85 OptionsPage.hideBubble(); | 85 PageManager.hideBubble(); |
| 86 return; | 86 return; |
| 87 } | 87 } |
| 88 | 88 |
| 89 if (!this.errorText_) | 89 if (!this.errorText_) |
| 90 return; | 90 return; |
| 91 | 91 |
| 92 var self = this; | 92 var self = this; |
| 93 // Create the DOM tree for the bubble content. | 93 // Create the DOM tree for the bubble content. |
| 94 var closeButton = document.createElement('div'); | 94 var closeButton = document.createElement('div'); |
| 95 closeButton.classList.add('close-button'); | 95 closeButton.classList.add('close-button'); |
| 96 | 96 |
| 97 var text = document.createElement('p'); | 97 var text = document.createElement('p'); |
| 98 text.innerHTML = this.errorText_; | 98 text.innerHTML = this.errorText_; |
| 99 | 99 |
| 100 var textDiv = document.createElement('div'); | 100 var textDiv = document.createElement('div'); |
| 101 textDiv.appendChild(text); | 101 textDiv.appendChild(text); |
| 102 | 102 |
| 103 var container = document.createElement('div'); | 103 var container = document.createElement('div'); |
| 104 container.appendChild(closeButton); | 104 container.appendChild(closeButton); |
| 105 container.appendChild(textDiv); | 105 container.appendChild(textDiv); |
| 106 | 106 |
| 107 var content = document.createElement('div'); | 107 var content = document.createElement('div'); |
| 108 content.appendChild(container); | 108 content.appendChild(container); |
| 109 | 109 |
| 110 OptionsPage.showBubble(content, this.image, this, this.location); | 110 PageManager.showBubble(content, this.image, this, this.location); |
| 111 }, | 111 }, |
| 112 }; | 112 }; |
| 113 | 113 |
| 114 // Export | 114 // Export |
| 115 return { | 115 return { |
| 116 HotwordSearchSettingIndicator: HotwordSearchSettingIndicator | 116 HotwordSearchSettingIndicator: HotwordSearchSettingIndicator |
| 117 }; | 117 }; |
| 118 }); | 118 }); |
| OLD | NEW |