Chromium Code Reviews| 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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 749 section.hidden = false; | 749 section.hidden = false; |
| 750 section.style.height = (showing ? 0 : container.offsetHeight) + 'px'; | 750 section.style.height = (showing ? 0 : container.offsetHeight) + 'px'; |
| 751 section.classList.add('sliding'); | 751 section.classList.add('sliding'); |
| 752 | 752 |
| 753 if (this.sectionHeightChangeTimeout_ !== null) | 753 if (this.sectionHeightChangeTimeout_ !== null) |
| 754 clearTimeout(this.sectionHeightChangeTimeout_); | 754 clearTimeout(this.sectionHeightChangeTimeout_); |
| 755 | 755 |
| 756 this.sectionHeightChangeTimeout_ = setTimeout(function() { | 756 this.sectionHeightChangeTimeout_ = setTimeout(function() { |
| 757 section.style.height = (showing ? container.offsetHeight : 0) + 'px'; | 757 section.style.height = (showing ? container.offsetHeight : 0) + 'px'; |
| 758 this.sectionHeightChangeTimeout_ = null; | 758 this.sectionHeightChangeTimeout_ = null; |
| 759 }); | 759 }, 0); |
| 760 }, | 760 }, |
| 761 | 761 |
| 762 /** | 762 /** |
| 763 * Shows the given section. | 763 * Shows the given section. |
| 764 * @param {HTMLElement} section The section to be shown. | 764 * @param {HTMLElement} section The section to be shown. |
| 765 * @param {HTMLElement} container The container for the section. Must be | 765 * @param {HTMLElement} container The container for the section. Must be |
| 766 * inside of |section|. | 766 * inside of |section|. |
| 767 * @param {boolean} animate Indicate if the expansion should be animated. | 767 * @param {boolean} animate Indicate if the expansion should be animated. |
| 768 * @private | 768 * @private |
| 769 */ | 769 */ |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1145 * doesn't start with 'http://' it is returned unchanged. | 1145 * doesn't start with 'http://' it is returned unchanged. |
| 1146 * @param {string} url The url to be processed | 1146 * @param {string} url The url to be processed |
| 1147 * @return {string} The url with the 'http://' removed. | 1147 * @return {string} The url with the 'http://' removed. |
| 1148 */ | 1148 */ |
| 1149 stripHttp_: function(url) { | 1149 stripHttp_: function(url) { |
| 1150 return url.replace(/^http:\/\//, ''); | 1150 return url.replace(/^http:\/\//, ''); |
| 1151 }, | 1151 }, |
| 1152 | 1152 |
| 1153 /** | 1153 /** |
| 1154 * Shows the autoLaunch preference and initializes its checkbox value. | 1154 * Shows the autoLaunch preference and initializes its checkbox value. |
| 1155 * @param {bool} enabled Whether autolaunch is enabled or or not. | 1155 * @param {boolean} enabled Whether autolaunch is enabled or or not. |
| 1156 * @private | 1156 * @private |
| 1157 */ | 1157 */ |
| 1158 updateAutoLaunchState_: function(enabled) { | 1158 updateAutoLaunchState_: function(enabled) { |
| 1159 $('auto-launch-option').hidden = false; | 1159 $('auto-launch-option').hidden = false; |
| 1160 $('auto-launch').checked = enabled; | 1160 $('auto-launch').checked = enabled; |
| 1161 }, | 1161 }, |
| 1162 | 1162 |
| 1163 /** | 1163 /** |
| 1164 * Called when the value of the download.default_directory preference | 1164 * Called when the value of the download.default_directory preference |
| 1165 * changes. | 1165 * changes. |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1528 setMetricsReportingSettingVisibility_: function(visible) { | 1528 setMetricsReportingSettingVisibility_: function(visible) { |
| 1529 if (visible) | 1529 if (visible) |
| 1530 $('metricsReportingSetting').style.display = 'block'; | 1530 $('metricsReportingSetting').style.display = 'block'; |
| 1531 else | 1531 else |
| 1532 $('metricsReportingSetting').style.display = 'none'; | 1532 $('metricsReportingSetting').style.display = 'none'; |
| 1533 }, | 1533 }, |
| 1534 | 1534 |
| 1535 /** | 1535 /** |
| 1536 * Set network prediction checkbox value. | 1536 * Set network prediction checkbox value. |
| 1537 * | 1537 * |
| 1538 * @param {Object} pref Information about network prediction options. | 1538 * @param {{value: number, disabled: boolean}} pref Information about |
| 1539 * @param {number} pref.value The value of network prediction options. | 1539 * network prediction options. |pref.value| is the value of network |
| 1540 * @param {boolean} pref.disabled If the pref is not user modifiable. | 1540 * prediction options. |pref.disabled| shows if the pref is not user |
| 1541 * modifiable. | |
| 1541 * @private | 1542 * @private |
| 1542 */ | 1543 */ |
| 1543 setNetworkPredictionValue_: function(pref) { | 1544 setNetworkPredictionValue_: function(pref) { |
| 1544 var checkbox = $('networkPredictionOptions'); | 1545 var checkbox = $('networkPredictionOptions'); |
| 1545 checkbox.disabled = pref.disabled; | 1546 checkbox.disabled = pref.disabled; |
| 1546 if (pref.value == NetworkPredictionOptions.UNSET) { | 1547 if (pref.value == NetworkPredictionOptions.UNSET) { |
| 1547 checkbox.checked = (NetworkPredictionOptions.DEFAULT != | 1548 checkbox.checked = (NetworkPredictionOptions.DEFAULT != |
| 1548 NetworkPredictionOptions.NEVER); | 1549 NetworkPredictionOptions.NEVER); |
| 1549 } else { | 1550 } else { |
| 1550 checkbox.checked = (pref.value != NetworkPredictionOptions.NEVER); | 1551 checkbox.checked = (pref.value != NetworkPredictionOptions.NEVER); |
| 1551 } | 1552 } |
| 1552 }, | 1553 }, |
| 1553 | 1554 |
| 1554 /** | 1555 /** |
| 1555 * Set the font size selected item. This item actually reflects two | 1556 * Set the font size selected item. This item actually reflects two |
| 1556 * preferences: the default font size and the default fixed font size. | 1557 * preferences: the default font size and the default fixed font size. |
| 1557 * | 1558 * |
| 1558 * @param {Object} pref Information about the font size preferences. | 1559 * @param {{value: number, disabled: boolean, controlledBy: string}} pref |
|
Dan Beam
2014/09/06 02:22:36
might be worth a typedef between here and L1538
Vitaly Pavlenko
2014/09/06 22:54:07
I don't think so. These are formed and called by t
| |
| 1559 * @param {number} pref.value The value of the default font size pref. | 1560 * Information about the font size preferences. |pref.value| is the |
| 1560 * @param {boolean} pref.disabled True if either pref not user modifiable. | 1561 * value of the default font size pref. |pref.disabled| is true if |
| 1561 * @param {string} pref.controlledBy The source of the pref value(s) if | 1562 * either pref not user modifiable. |pref.controlledBy| is the source of |
| 1562 * either pref is currently not controlled by the user. | 1563 * the pref value(s) if either pref is currently not controlled by the |
| 1564 * user. | |
| 1563 * @private | 1565 * @private |
| 1564 */ | 1566 */ |
| 1565 setFontSize_: function(pref) { | 1567 setFontSize_: function(pref) { |
| 1566 var selectCtl = $('defaultFontSize'); | 1568 var selectCtl = $('defaultFontSize'); |
| 1567 selectCtl.disabled = pref.disabled; | 1569 selectCtl.disabled = pref.disabled; |
| 1568 // Create a synthetic pref change event decorated as | 1570 // Create a synthetic pref change event decorated as |
| 1569 // CoreOptionsHandler::CreateValueForPref() does. | 1571 // CoreOptionsHandler::CreateValueForPref() does. |
| 1570 var event = new Event('synthetic-font-size'); | 1572 var event = new Event('synthetic-font-size'); |
| 1571 event.value = { | 1573 event.value = { |
| 1572 value: pref.value, | 1574 value: pref.value, |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1979 BrowserOptions.getLoggedInUsername = function() { | 1981 BrowserOptions.getLoggedInUsername = function() { |
| 1980 return BrowserOptions.getInstance().username_; | 1982 return BrowserOptions.getInstance().username_; |
| 1981 }; | 1983 }; |
| 1982 } | 1984 } |
| 1983 | 1985 |
| 1984 // Export | 1986 // Export |
| 1985 return { | 1987 return { |
| 1986 BrowserOptions: BrowserOptions | 1988 BrowserOptions: BrowserOptions |
| 1987 }; | 1989 }; |
| 1988 }); | 1990 }); |
| OLD | NEW |