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 cr.exportPath('options'); | 5 cr.exportPath('options'); |
6 | 6 |
7 /** | 7 /** |
8 * @typedef {{actionLinkText: (string|undefined), | 8 * @typedef {{actionLinkText: (string|undefined), |
9 * childUser: (boolean|undefined), | 9 * childUser: (boolean|undefined), |
10 * hasError: (boolean|undefined), | 10 * hasError: (boolean|undefined), |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // text" where both starting text and ending text may or may not be | 455 // text" where both starting text and ending text may or may not be |
456 // present, but the split should always be in three pieces. | 456 // present, but the split should always be in three pieces. |
457 var restartElements = | 457 var restartElements = |
458 $('metrics-reporting-reset-restart').querySelectorAll('*'); | 458 $('metrics-reporting-reset-restart').querySelectorAll('*'); |
459 for (var i = 0; i < restartTextFragments.length; i++) { | 459 for (var i = 0; i < restartTextFragments.length; i++) { |
460 restartElements[i].textContent = restartTextFragments[i]; | 460 restartElements[i].textContent = restartTextFragments[i]; |
461 } | 461 } |
462 restartElements[1].onclick = function(event) { | 462 restartElements[1].onclick = function(event) { |
463 chrome.send('restartBrowser'); | 463 chrome.send('restartBrowser'); |
464 }; | 464 }; |
465 // Attach the listener for updating the checkbox and restart button. | 465 $('metrics-reporting-enabled').onclick = function(event) { |
466 var updateMetricsRestartButton = function() { | 466 chrome.send('metricsReportingCheckboxChanged', |
| 467 [Boolean(event.currentTarget.checked)]); |
| 468 if (cr.isMac) { |
| 469 // A browser restart is never needed to toggle metrics reporting, |
| 470 // and is only needed to toggle crash reporting when using Breakpad. |
| 471 // Crashpad, used on Mac, does not require a browser restart. |
| 472 return; |
| 473 } |
467 $('metrics-reporting-reset-restart').hidden = | 474 $('metrics-reporting-reset-restart').hidden = |
468 loadTimeData.getBoolean('metricsReportingEnabledAtStart') == | 475 loadTimeData.getBoolean('metricsReportingEnabledAtStart') == |
469 $('metrics-reporting-enabled').checked; | 476 $('metrics-reporting-enabled').checked; |
470 }; | 477 }; |
471 $('metrics-reporting-enabled').onclick = function(event) { | |
472 chrome.send('metricsReportingCheckboxChanged', | |
473 [Boolean(event.currentTarget.checked)]); | |
474 updateMetricsRestartButton(); | |
475 }; | |
476 $('metrics-reporting-enabled').checked = | 478 $('metrics-reporting-enabled').checked = |
477 loadTimeData.getBoolean('metricsReportingEnabledAtStart'); | 479 loadTimeData.getBoolean('metricsReportingEnabledAtStart'); |
478 updateMetricsRestartButton(); | |
479 } | 480 } |
480 // 'rappor-setting' element is only present on Chrome branded builds. | 481 // 'rappor-setting' element is only present on Chrome branded builds. |
481 if ($('rappor-setting')) { | 482 if ($('rappor-setting')) { |
482 $('rappor-setting').hidden = | 483 $('rappor-setting').hidden = |
483 !loadTimeData.getBoolean('hasRapporOption'); | 484 !loadTimeData.getBoolean('hasRapporOption'); |
484 } | 485 } |
485 $('networkPredictionOptions').onchange = function(event) { | 486 $('networkPredictionOptions').onchange = function(event) { |
486 var value = (event.target.checked ? | 487 var value = (event.target.checked ? |
487 NetworkPredictionOptions.WIFI_ONLY : | 488 NetworkPredictionOptions.WIFI_ONLY : |
488 NetworkPredictionOptions.NEVER); | 489 NetworkPredictionOptions.NEVER); |
(...skipping 1777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2266 } | 2267 } |
2267 button.textContent = loadTimeData.getString(strId); | 2268 button.textContent = loadTimeData.getString(strId); |
2268 }; | 2269 }; |
2269 } | 2270 } |
2270 | 2271 |
2271 // Export | 2272 // Export |
2272 return { | 2273 return { |
2273 BrowserOptions: BrowserOptions | 2274 BrowserOptions: BrowserOptions |
2274 }; | 2275 }; |
2275 }); | 2276 }); |
OLD | NEW |