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 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 'startpage-controlled', | 655 'startpage-controlled', |
656 false); | 656 false); |
657 this.addExtensionControlledBox_('newtab-section-content', | 657 this.addExtensionControlledBox_('newtab-section-content', |
658 'newtab-controlled', | 658 'newtab-controlled', |
659 false); | 659 false); |
660 this.addExtensionControlledBox_('proxy-section-content', | 660 this.addExtensionControlledBox_('proxy-section-content', |
661 'proxy-controlled', | 661 'proxy-controlled', |
662 true); | 662 true); |
663 | 663 |
664 document.body.addEventListener('click', function(e) { | 664 document.body.addEventListener('click', function(e) { |
665 var button = findAncestor(e.target, function(el) { | 665 var target = assertInstanceof(e.target, Node); |
| 666 var button = findAncestor(target, function(el) { |
666 return el.tagName == 'BUTTON' && | 667 return el.tagName == 'BUTTON' && |
667 el.dataset.extensionId !== undefined && | 668 el.dataset.extensionId !== undefined && |
668 el.dataset.extensionId.length; | 669 el.dataset.extensionId.length; |
669 }); | 670 }); |
670 if (button) | 671 if (button) |
671 chrome.send('disableExtension', [button.dataset.extensionId]); | 672 chrome.send('disableExtension', [button.dataset.extensionId]); |
672 }); | 673 }); |
673 }, | 674 }, |
674 | 675 |
675 /** @override */ | 676 /** @override */ |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 StartupOverlay.getInstance().updateControlStates(); | 712 StartupOverlay.getInstance().updateControlStates(); |
712 } | 713 } |
713 }, | 714 }, |
714 | 715 |
715 /** | 716 /** |
716 * Handler for messages sent from the main uber page. | 717 * Handler for messages sent from the main uber page. |
717 * @param {Event} e The 'message' event from the uber page. | 718 * @param {Event} e The 'message' event from the uber page. |
718 * @private | 719 * @private |
719 */ | 720 */ |
720 handleWindowMessage_: function(e) { | 721 handleWindowMessage_: function(e) { |
721 if (e.data.method == 'frameSelected') | 722 if ((/** @type {{method: string}} */(e.data)).method == 'frameSelected') |
722 $('search-field').focus(); | 723 $('search-field').focus(); |
723 }, | 724 }, |
724 | 725 |
725 /** | 726 /** |
726 * Animatedly changes height |from| a px number |to| a px number. | 727 * Animatedly changes height |from| a px number |to| a px number. |
727 * @param {HTMLElement} section The section to animate. | 728 * @param {HTMLElement} section The section to animate. |
728 * @param {HTMLElement} container The container of |section|. | 729 * @param {HTMLElement} container The container of |section|. |
729 * @param {boolean} showing Whether to go from 0 -> container height or | 730 * @param {boolean} showing Whether to go from 0 -> container height or |
730 * container height -> 0. | 731 * container height -> 0. |
731 * @private | 732 * @private |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 * Sets or clear whether Chrome should Auto-launch on computer startup. | 1246 * Sets or clear whether Chrome should Auto-launch on computer startup. |
1246 * @private | 1247 * @private |
1247 */ | 1248 */ |
1248 handleAutoLaunchChanged_: function() { | 1249 handleAutoLaunchChanged_: function() { |
1249 chrome.send('toggleAutoLaunch', [$('auto-launch').checked]); | 1250 chrome.send('toggleAutoLaunch', [$('auto-launch').checked]); |
1250 }, | 1251 }, |
1251 | 1252 |
1252 /** | 1253 /** |
1253 * Get the selected profile item from the profile list. This also works | 1254 * Get the selected profile item from the profile list. This also works |
1254 * correctly if the list is not displayed. | 1255 * correctly if the list is not displayed. |
1255 * @return {Object} the profile item object, or null if nothing is selected. | 1256 * @return {?Object} The profile item object, or null if nothing is |
| 1257 * selected. |
1256 * @private | 1258 * @private |
1257 */ | 1259 */ |
1258 getSelectedProfileItem_: function() { | 1260 getSelectedProfileItem_: function() { |
1259 var profilesList = $('profiles-list'); | 1261 var profilesList = $('profiles-list'); |
1260 if (profilesList.hidden) { | 1262 if (profilesList.hidden) { |
1261 if (profilesList.dataModel.length > 0) | 1263 if (profilesList.dataModel.length > 0) |
1262 return profilesList.dataModel.item(0); | 1264 return profilesList.dataModel.item(0); |
1263 } else { | 1265 } else { |
1264 return profilesList.selectedItem; | 1266 return profilesList.selectedItem; |
1265 } | 1267 } |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 } | 2023 } |
2022 button.textContent = loadTimeData.getString(strId); | 2024 button.textContent = loadTimeData.getString(strId); |
2023 }; | 2025 }; |
2024 } | 2026 } |
2025 | 2027 |
2026 // Export | 2028 // Export |
2027 return { | 2029 return { |
2028 BrowserOptions: BrowserOptions | 2030 BrowserOptions: BrowserOptions |
2029 }; | 2031 }; |
2030 }); | 2032 }); |
OLD | NEW |