OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** | 5 /** |
6 * This variable structure is here to document the structure that the template | 6 * This variable structure is here to document the structure that the template |
7 * expects to correctly populate the page. | 7 * expects to correctly populate the page. |
8 */ | 8 */ |
9 | 9 |
10 /** | 10 /** |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 * 'Mac', | 124 * 'Mac', |
125 * 'Linux' | 125 * 'Linux' |
126 * ], | 126 * ], |
127 * } | 127 * } |
128 * ], | 128 * ], |
129 * unsupportedExperiments: [ | 129 * unsupportedExperiments: [ |
130 * // Mirrors the format of |supportedExperiments| above. | 130 * // Mirrors the format of |supportedExperiments| above. |
131 * ], | 131 * ], |
132 * needsRestart: false, | 132 * needsRestart: false, |
133 * showBetaChannelPromotion: false, | 133 * showBetaChannelPromotion: false, |
134 * showDevChannelPromotion: false | 134 * showDevChannelPromotion: false, |
| 135 * showOwnerWarning: false |
135 * } | 136 * } |
136 */ | 137 */ |
137 function returnFlagsExperiments(experimentsData) { | 138 function returnFlagsExperiments(experimentsData) { |
138 var bodyContainer = $('body-container'); | 139 var bodyContainer = $('body-container'); |
139 renderTemplate(experimentsData); | 140 renderTemplate(experimentsData); |
140 | 141 |
141 if (experimentsData.showBetaChannelPromotion) | 142 if (experimentsData.showBetaChannelPromotion) |
142 $('channel-promo-beta').hidden = false; | 143 $('channel-promo-beta').hidden = false; |
143 else if (experimentsData.showDevChannelPromotion) | 144 else if (experimentsData.showDevChannelPromotion) |
144 $('channel-promo-dev').hidden = false; | 145 $('channel-promo-dev').hidden = false; |
145 | 146 |
146 bodyContainer.style.visibility = 'visible'; | 147 bodyContainer.style.visibility = 'visible'; |
| 148 var ownerWarningDiv = $('owner-warning'); |
| 149 if (ownerWarningDiv) |
| 150 ownerWarningDiv.hidden = !experimentsData.showOwnerWarning; |
147 } | 151 } |
148 | 152 |
149 /** | 153 /** |
150 * Handles a 'enable' or 'disable' button getting clicked. | 154 * Handles a 'enable' or 'disable' button getting clicked. |
151 * @param {HTMLElement} node The node for the experiment being changed. | 155 * @param {HTMLElement} node The node for the experiment being changed. |
152 * @param {boolean} enable Whether to enable or disable the experiment. | 156 * @param {boolean} enable Whether to enable or disable the experiment. |
153 */ | 157 */ |
154 function handleEnableExperiment(node, enable) { | 158 function handleEnableExperiment(node, enable) { |
155 // Tell the C++ FlagsDOMHandler to enable/disable the experiment. | 159 // Tell the C++ FlagsDOMHandler to enable/disable the experiment. |
156 chrome.send('enableFlagsExperiment', [String(node.internal_name), | 160 chrome.send('enableFlagsExperiment', [String(node.internal_name), |
(...skipping 12 matching lines...) Expand all Loading... |
169 chrome.send('enableFlagsExperiment', | 173 chrome.send('enableFlagsExperiment', |
170 [String(node.internal_name) + '@' + index, 'true']); | 174 [String(node.internal_name) + '@' + index, 'true']); |
171 requestFlagsExperimentsData(); | 175 requestFlagsExperimentsData(); |
172 } | 176 } |
173 | 177 |
174 // Get data and have it displayed upon loading. | 178 // Get data and have it displayed upon loading. |
175 document.addEventListener('DOMContentLoaded', requestFlagsExperimentsData); | 179 document.addEventListener('DOMContentLoaded', requestFlagsExperimentsData); |
176 | 180 |
177 // Update the highlighted flag when the hash changes. | 181 // Update the highlighted flag when the hash changes. |
178 window.addEventListener('hashchange', highlightReferencedFlag); | 182 window.addEventListener('hashchange', highlightReferencedFlag); |
OLD | NEW |