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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
744 section.hidden = false; | 744 section.hidden = false; |
745 section.style.height = (showing ? 0 : container.offsetHeight) + 'px'; | 745 section.style.height = (showing ? 0 : container.offsetHeight) + 'px'; |
746 section.classList.add('sliding'); | 746 section.classList.add('sliding'); |
747 | 747 |
748 if (this.sectionHeightChangeTimeout_ !== null) | 748 if (this.sectionHeightChangeTimeout_ !== null) |
749 clearTimeout(this.sectionHeightChangeTimeout_); | 749 clearTimeout(this.sectionHeightChangeTimeout_); |
750 | 750 |
751 this.sectionHeightChangeTimeout_ = setTimeout(function() { | 751 this.sectionHeightChangeTimeout_ = setTimeout(function() { |
752 section.style.height = (showing ? container.offsetHeight : 0) + 'px'; | 752 section.style.height = (showing ? container.offsetHeight : 0) + 'px'; |
753 this.sectionHeightChangeTimeout_ = null; | 753 this.sectionHeightChangeTimeout_ = null; |
754 }); | 754 }, 0); |
755 }, | 755 }, |
756 | 756 |
757 /** | 757 /** |
758 * Shows the given section. | 758 * Shows the given section. |
759 * @param {HTMLElement} section The section to be shown. | 759 * @param {HTMLElement} section The section to be shown. |
760 * @param {HTMLElement} container The container for the section. Must be | 760 * @param {HTMLElement} container The container for the section. Must be |
761 * inside of |section|. | 761 * inside of |section|. |
762 * @param {boolean} animate Indicate if the expansion should be animated. | 762 * @param {boolean} animate Indicate if the expansion should be animated. |
763 * @private | 763 * @private |
764 */ | 764 */ |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 * doesn't start with 'http://' it is returned unchanged. | 1140 * doesn't start with 'http://' it is returned unchanged. |
1141 * @param {string} url The url to be processed | 1141 * @param {string} url The url to be processed |
1142 * @return {string} The url with the 'http://' removed. | 1142 * @return {string} The url with the 'http://' removed. |
1143 */ | 1143 */ |
1144 stripHttp_: function(url) { | 1144 stripHttp_: function(url) { |
1145 return url.replace(/^http:\/\//, ''); | 1145 return url.replace(/^http:\/\//, ''); |
1146 }, | 1146 }, |
1147 | 1147 |
1148 /** | 1148 /** |
1149 * Shows the autoLaunch preference and initializes its checkbox value. | 1149 * Shows the autoLaunch preference and initializes its checkbox value. |
1150 * @param {bool} enabled Whether autolaunch is enabled or or not. | 1150 * @param {boolean} enabled Whether autolaunch is enabled or or not. |
1151 * @private | 1151 * @private |
1152 */ | 1152 */ |
1153 updateAutoLaunchState_: function(enabled) { | 1153 updateAutoLaunchState_: function(enabled) { |
1154 $('auto-launch-option').hidden = false; | 1154 $('auto-launch-option').hidden = false; |
1155 $('auto-launch').checked = enabled; | 1155 $('auto-launch').checked = enabled; |
1156 }, | 1156 }, |
1157 | 1157 |
1158 /** | 1158 /** |
1159 * Called when the value of the download.default_directory preference | 1159 * Called when the value of the download.default_directory preference |
1160 * changes. | 1160 * changes. |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 setMetricsReportingSettingVisibility_: function(visible) { | 1523 setMetricsReportingSettingVisibility_: function(visible) { |
1524 if (visible) | 1524 if (visible) |
1525 $('metricsReportingSetting').style.display = 'block'; | 1525 $('metricsReportingSetting').style.display = 'block'; |
1526 else | 1526 else |
1527 $('metricsReportingSetting').style.display = 'none'; | 1527 $('metricsReportingSetting').style.display = 'none'; |
1528 }, | 1528 }, |
1529 | 1529 |
1530 /** | 1530 /** |
1531 * Set network prediction checkbox value. | 1531 * Set network prediction checkbox value. |
1532 * | 1532 * |
1533 * @param {Object} pref Information about network prediction options. | 1533 * @param {{value: number, disabled: boolean}} pref Information about |
1534 * @param {number} pref.value The value of network prediction options. | 1534 * network prediction options. |pref.value| is the value of network |
1535 * @param {boolean} pref.disabled If the pref is not user modifiable. | 1535 * prediction options. |pref.disabled| shows if the pref is not user |
| 1536 * modifiable. |
1536 * @private | 1537 * @private |
1537 */ | 1538 */ |
1538 setNetworkPredictionValue_: function(pref) { | 1539 setNetworkPredictionValue_: function(pref) { |
1539 var checkbox = $('networkPredictionOptions'); | 1540 var checkbox = $('networkPredictionOptions'); |
1540 checkbox.disabled = pref.disabled; | 1541 checkbox.disabled = pref.disabled; |
1541 if (pref.value == NetworkPredictionOptions.UNSET) { | 1542 if (pref.value == NetworkPredictionOptions.UNSET) { |
1542 checkbox.checked = (NetworkPredictionOptions.DEFAULT != | 1543 checkbox.checked = (NetworkPredictionOptions.DEFAULT != |
1543 NetworkPredictionOptions.NEVER); | 1544 NetworkPredictionOptions.NEVER); |
1544 } else { | 1545 } else { |
1545 checkbox.checked = (pref.value != NetworkPredictionOptions.NEVER); | 1546 checkbox.checked = (pref.value != NetworkPredictionOptions.NEVER); |
1546 } | 1547 } |
1547 }, | 1548 }, |
1548 | 1549 |
1549 /** | 1550 /** |
1550 * Set the font size selected item. This item actually reflects two | 1551 * Set the font size selected item. This item actually reflects two |
1551 * preferences: the default font size and the default fixed font size. | 1552 * preferences: the default font size and the default fixed font size. |
1552 * | 1553 * |
1553 * @param {Object} pref Information about the font size preferences. | 1554 * @param {{value: number, disabled: boolean, controlledBy: string}} pref |
1554 * @param {number} pref.value The value of the default font size pref. | 1555 * Information about the font size preferences. |pref.value| is the |
1555 * @param {boolean} pref.disabled True if either pref not user modifiable. | 1556 * value of the default font size pref. |pref.disabled| is true if |
1556 * @param {string} pref.controlledBy The source of the pref value(s) if | 1557 * either pref not user modifiable. |pref.controlledBy| is the source of |
1557 * either pref is currently not controlled by the user. | 1558 * the pref value(s) if either pref is currently not controlled by the |
| 1559 * user. |
1558 * @private | 1560 * @private |
1559 */ | 1561 */ |
1560 setFontSize_: function(pref) { | 1562 setFontSize_: function(pref) { |
1561 var selectCtl = $('defaultFontSize'); | 1563 var selectCtl = $('defaultFontSize'); |
1562 selectCtl.disabled = pref.disabled; | 1564 selectCtl.disabled = pref.disabled; |
1563 // Create a synthetic pref change event decorated as | 1565 // Create a synthetic pref change event decorated as |
1564 // CoreOptionsHandler::CreateValueForPref() does. | 1566 // CoreOptionsHandler::CreateValueForPref() does. |
1565 var event = new Event('synthetic-font-size'); | 1567 var event = new Event('synthetic-font-size'); |
1566 event.value = { | 1568 event.value = { |
1567 value: pref.value, | 1569 value: pref.value, |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1974 BrowserOptions.getLoggedInUsername = function() { | 1976 BrowserOptions.getLoggedInUsername = function() { |
1975 return BrowserOptions.getInstance().username_; | 1977 return BrowserOptions.getInstance().username_; |
1976 }; | 1978 }; |
1977 } | 1979 } |
1978 | 1980 |
1979 // Export | 1981 // Export |
1980 return { | 1982 return { |
1981 BrowserOptions: BrowserOptions | 1983 BrowserOptions: BrowserOptions |
1982 }; | 1984 }; |
1983 }); | 1985 }); |
OLD | NEW |