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.define('options', function() { | 5 cr.define('options', function() { |
6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
7 var Page = cr.ui.pageManager.Page; | 7 var Page = cr.ui.pageManager.Page; |
8 var PageManager = cr.ui.pageManager.PageManager; | 8 var PageManager = cr.ui.pageManager.PageManager; |
9 var ArrayDataModel = cr.ui.ArrayDataModel; | 9 var ArrayDataModel = cr.ui.ArrayDataModel; |
10 var RepeatingButton = cr.ui.RepeatingButton; | 10 var RepeatingButton = cr.ui.RepeatingButton; |
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1123 * doesn't start with 'http://' it is returned unchanged. | 1123 * doesn't start with 'http://' it is returned unchanged. |
1124 * @param {string} url The url to be processed | 1124 * @param {string} url The url to be processed |
1125 * @return {string} The url with the 'http://' removed. | 1125 * @return {string} The url with the 'http://' removed. |
1126 */ | 1126 */ |
1127 stripHttp_: function(url) { | 1127 stripHttp_: function(url) { |
1128 return url.replace(/^http:\/\//, ''); | 1128 return url.replace(/^http:\/\//, ''); |
1129 }, | 1129 }, |
1130 | 1130 |
1131 /** | 1131 /** |
1132 * Shows the autoLaunch preference and initializes its checkbox value. | 1132 * Shows the autoLaunch preference and initializes its checkbox value. |
1133 * @param {bool} enabled Whether autolaunch is enabled or or not. | 1133 * @param {boolean} enabled Whether autolaunch is enabled or or not. |
1134 * @private | 1134 * @private |
1135 */ | 1135 */ |
1136 updateAutoLaunchState_: function(enabled) { | 1136 updateAutoLaunchState_: function(enabled) { |
1137 $('auto-launch-option').hidden = false; | 1137 $('auto-launch-option').hidden = false; |
1138 $('auto-launch').checked = enabled; | 1138 $('auto-launch').checked = enabled; |
1139 }, | 1139 }, |
1140 | 1140 |
1141 /** | 1141 /** |
1142 * Called when the value of the download.default_directory preference | 1142 * Called when the value of the download.default_directory preference |
1143 * changes. | 1143 * changes. |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1506 setMetricsReportingSettingVisibility_: function(visible) { | 1506 setMetricsReportingSettingVisibility_: function(visible) { |
1507 if (visible) | 1507 if (visible) |
1508 $('metricsReportingSetting').style.display = 'block'; | 1508 $('metricsReportingSetting').style.display = 'block'; |
1509 else | 1509 else |
1510 $('metricsReportingSetting').style.display = 'none'; | 1510 $('metricsReportingSetting').style.display = 'none'; |
1511 }, | 1511 }, |
1512 | 1512 |
1513 /** | 1513 /** |
1514 * Set network prediction checkbox value. | 1514 * Set network prediction checkbox value. |
1515 * | 1515 * |
1516 * @param {Object} pref Information about network prediction options. | 1516 * @param {{value: number, disabled: boolean}} pref Information about |
1517 * @param {number} pref.value The value of network prediction options. | 1517 * network prediction options. |pref.value| is the value of network |
1518 * @param {boolean} pref.disabled If the pref is not user modifiable. | 1518 * prediction options. |pref.disabled| shows if the pref is not user |
| 1519 * modifiable. |
1519 * @private | 1520 * @private |
1520 */ | 1521 */ |
1521 setNetworkPredictionValue_: function(pref) { | 1522 setNetworkPredictionValue_: function(pref) { |
1522 var checkbox = $('networkPredictionOptions'); | 1523 var checkbox = $('networkPredictionOptions'); |
1523 checkbox.disabled = pref.disabled; | 1524 checkbox.disabled = pref.disabled; |
1524 if (pref.value == NetworkPredictionOptions.UNSET) { | 1525 if (pref.value == NetworkPredictionOptions.UNSET) { |
1525 checkbox.checked = (NetworkPredictionOptions.DEFAULT != | 1526 checkbox.checked = (NetworkPredictionOptions.DEFAULT != |
1526 NetworkPredictionOptions.NEVER); | 1527 NetworkPredictionOptions.NEVER); |
1527 } else { | 1528 } else { |
1528 checkbox.checked = (pref.value != NetworkPredictionOptions.NEVER); | 1529 checkbox.checked = (pref.value != NetworkPredictionOptions.NEVER); |
1529 } | 1530 } |
1530 }, | 1531 }, |
1531 | 1532 |
1532 /** | 1533 /** |
1533 * Set the font size selected item. This item actually reflects two | 1534 * Set the font size selected item. This item actually reflects two |
1534 * preferences: the default font size and the default fixed font size. | 1535 * preferences: the default font size and the default fixed font size. |
1535 * | 1536 * |
1536 * @param {Object} pref Information about the font size preferences. | 1537 * @param {{value: number, disabled: boolean, controlledBy: string}} pref |
1537 * @param {number} pref.value The value of the default font size pref. | 1538 * Information about the font size preferences. |pref.value| is the |
1538 * @param {boolean} pref.disabled True if either pref not user modifiable. | 1539 * value of the default font size pref. |pref.disabled| is true if |
1539 * @param {string} pref.controlledBy The source of the pref value(s) if | 1540 * either pref not user modifiable. |pref.controlledBy| is the source of |
1540 * either pref is currently not controlled by the user. | 1541 * the pref value(s) if either pref is currently not controlled by the |
| 1542 * user. |
1541 * @private | 1543 * @private |
1542 */ | 1544 */ |
1543 setFontSize_: function(pref) { | 1545 setFontSize_: function(pref) { |
1544 var selectCtl = $('defaultFontSize'); | 1546 var selectCtl = $('defaultFontSize'); |
1545 selectCtl.disabled = pref.disabled; | 1547 selectCtl.disabled = pref.disabled; |
1546 // Create a synthetic pref change event decorated as | 1548 // Create a synthetic pref change event decorated as |
1547 // CoreOptionsHandler::CreateValueForPref() does. | 1549 // CoreOptionsHandler::CreateValueForPref() does. |
1548 var event = new Event('synthetic-font-size'); | 1550 var event = new Event('synthetic-font-size'); |
1549 event.value = { | 1551 event.value = { |
1550 value: pref.value, | 1552 value: pref.value, |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 } | 1996 } |
1995 button.textContent = loadTimeData.getString(strId); | 1997 button.textContent = loadTimeData.getString(strId); |
1996 }; | 1998 }; |
1997 } | 1999 } |
1998 | 2000 |
1999 // Export | 2001 // Export |
2000 return { | 2002 return { |
2001 BrowserOptions: BrowserOptions | 2003 BrowserOptions: BrowserOptions |
2002 }; | 2004 }; |
2003 }); | 2005 }); |
OLD | NEW |