| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * UI Pages. Note the order must be in sync with the ArcAuthService::UIPage | 6 * UI Pages. Note the order must be in sync with the ArcAuthService::UIPage |
| 7 * enum. | 7 * enum. |
| 8 * @type {Array<string>} | 8 * @type {Array<string>} |
| 9 */ | 9 */ |
| 10 var UI_PAGES = ['none', | 10 var UI_PAGES = ['none', |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 /** | 142 /** |
| 143 * Sets current metrics mode. | 143 * Sets current metrics mode. |
| 144 * @param {string} text Describes current metrics state. | 144 * @param {string} text Describes current metrics state. |
| 145 * @param {boolean} canEnable Defines if user is allowed to change this metrics | 145 * @param {boolean} canEnable Defines if user is allowed to change this metrics |
| 146 * option. | 146 * option. |
| 147 * @param {boolean} on Defines if metrics are active currently. | 147 * @param {boolean} on Defines if metrics are active currently. |
| 148 */ | 148 */ |
| 149 function setMetricsMode(text, canEnable, on) { | 149 function setMetricsMode(text, canEnable, on) { |
| 150 var doc = appWindow.contentWindow.document; | 150 var doc = appWindow.contentWindow.document; |
| 151 var enableMetrics = doc.getElementById('enable-metrics'); | 151 var enableMetrics = doc.getElementById('enable-metrics'); |
| 152 var enableMetricsContainer = doc.getElementById('enable-metrics-container'); | 152 enableMetrics.hidden = !canEnable; |
| 153 enableMetricsContainer.hidden = !canEnable; | |
| 154 enableMetrics.checked = on; | 153 enableMetrics.checked = on; |
| 155 | 154 |
| 156 var onSettings = function(event) { | 155 var onSettings = function(event) { |
| 157 chrome.browser.openTab({'url': 'chrome://settings'}, function() {}); | 156 chrome.browser.openTab({'url': 'chrome://settings'}, function() {}); |
| 158 event.preventDefault(); | 157 event.preventDefault(); |
| 159 }; | 158 }; |
| 160 | 159 |
| 161 doc.getElementById('text-metrics').innerHTML = text; | 160 doc.getElementById('text-metrics').innerHTML = text; |
| 162 doc.getElementById('settings-link').addEventListener('click', onSettings); | 161 doc.getElementById('settings-link').addEventListener('click', onSettings); |
| 163 doc.getElementById('learn-more-link-metrics').addEventListener('click', | 162 doc.getElementById('learn-more-link-metrics').addEventListener('click', |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 type: 'chrome', | 561 type: 'chrome', |
| 563 color: '#ffffff' | 562 color: '#ffffff' |
| 564 }, | 563 }, |
| 565 'innerBounds': { | 564 'innerBounds': { |
| 566 'width': INNER_WIDTH, | 565 'width': INNER_WIDTH, |
| 567 'height': INNER_HEIGHT | 566 'height': INNER_HEIGHT |
| 568 } | 567 } |
| 569 }; | 568 }; |
| 570 chrome.app.window.create('main.html', options, onWindowCreated); | 569 chrome.app.window.create('main.html', options, onWindowCreated); |
| 571 }); | 570 }); |
| OLD | NEW |