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 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 643 this.addExtensionControlledBox_('startup-section-content', | 643 this.addExtensionControlledBox_('startup-section-content', |
| 644 'startpage-controlled', | 644 'startpage-controlled', |
| 645 false); | 645 false); |
| 646 this.addExtensionControlledBox_('newtab-section-content', | 646 this.addExtensionControlledBox_('newtab-section-content', |
| 647 'newtab-controlled', | 647 'newtab-controlled', |
| 648 false); | 648 false); |
| 649 this.addExtensionControlledBox_('proxy-section-content', | 649 this.addExtensionControlledBox_('proxy-section-content', |
| 650 'proxy-controlled', | 650 'proxy-controlled', |
| 651 true); | 651 true); |
| 652 | 652 |
| 653 document.body.addEventListener('click', function(e) { | 653 document.body.addEventListener('click', function(e) { |
|
Dan Beam
2014/09/12 03:25:19
var target = assertInstanceof(e.target, Node);
Vitaly Pavlenko
2014/09/12 19:16:22
Done.
| |
| 654 var button = findAncestor(e.target, function(el) { | 654 var button = findAncestor(assertInstanceof(e.target, Node), |
| 655 function(el) { | |
| 655 return el.tagName == 'BUTTON' && | 656 return el.tagName == 'BUTTON' && |
| 656 el.dataset.extensionId !== undefined && | 657 el.dataset.extensionId !== undefined && |
| 657 el.dataset.extensionId.length; | 658 el.dataset.extensionId.length; |
| 658 }); | 659 }); |
| 659 if (button) | 660 if (button) |
| 660 chrome.send('disableExtension', [button.dataset.extensionId]); | 661 chrome.send('disableExtension', [button.dataset.extensionId]); |
| 661 }); | 662 }); |
| 662 }, | 663 }, |
| 663 | 664 |
| 664 /** @override */ | 665 /** @override */ |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 700 StartupOverlay.getInstance().updateControlStates(); | 701 StartupOverlay.getInstance().updateControlStates(); |
| 701 } | 702 } |
| 702 }, | 703 }, |
| 703 | 704 |
| 704 /** | 705 /** |
| 705 * Handler for messages sent from the main uber page. | 706 * Handler for messages sent from the main uber page. |
| 706 * @param {Event} e The 'message' event from the uber page. | 707 * @param {Event} e The 'message' event from the uber page. |
| 707 * @private | 708 * @private |
| 708 */ | 709 */ |
| 709 handleWindowMessage_: function(e) { | 710 handleWindowMessage_: function(e) { |
| 710 if (e.data.method == 'frameSelected') | 711 if ((/** @type {{method: string}} */(e.data)).method == 'frameSelected') |
| 711 $('search-field').focus(); | 712 $('search-field').focus(); |
| 712 }, | 713 }, |
| 713 | 714 |
| 714 /** | 715 /** |
| 715 * Animatedly changes height |from| a px number |to| a px number. | 716 * Animatedly changes height |from| a px number |to| a px number. |
| 716 * @param {HTMLElement} section The section to animate. | 717 * @param {HTMLElement} section The section to animate. |
| 717 * @param {HTMLElement} container The container of |section|. | 718 * @param {HTMLElement} container The container of |section|. |
| 718 * @param {boolean} showing Whether to go from 0 -> container height or | 719 * @param {boolean} showing Whether to go from 0 -> container height or |
| 719 * container height -> 0. | 720 * container height -> 0. |
| 720 * @private | 721 * @private |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1234 * Sets or clear whether Chrome should Auto-launch on computer startup. | 1235 * Sets or clear whether Chrome should Auto-launch on computer startup. |
| 1235 * @private | 1236 * @private |
| 1236 */ | 1237 */ |
| 1237 handleAutoLaunchChanged_: function() { | 1238 handleAutoLaunchChanged_: function() { |
| 1238 chrome.send('toggleAutoLaunch', [$('auto-launch').checked]); | 1239 chrome.send('toggleAutoLaunch', [$('auto-launch').checked]); |
| 1239 }, | 1240 }, |
| 1240 | 1241 |
| 1241 /** | 1242 /** |
| 1242 * Get the selected profile item from the profile list. This also works | 1243 * Get the selected profile item from the profile list. This also works |
| 1243 * correctly if the list is not displayed. | 1244 * correctly if the list is not displayed. |
| 1244 * @return {Object} the profile item object, or null if nothing is selected. | 1245 * @return {?Object} The profile item object, or null if nothing is |
| 1246 * selected. | |
| 1245 * @private | 1247 * @private |
| 1246 */ | 1248 */ |
| 1247 getSelectedProfileItem_: function() { | 1249 getSelectedProfileItem_: function() { |
| 1248 var profilesList = $('profiles-list'); | 1250 var profilesList = $('profiles-list'); |
| 1249 if (profilesList.hidden) { | 1251 if (profilesList.hidden) { |
| 1250 if (profilesList.dataModel.length > 0) | 1252 if (profilesList.dataModel.length > 0) |
| 1251 return profilesList.dataModel.item(0); | 1253 return profilesList.dataModel.item(0); |
| 1252 } else { | 1254 } else { |
| 1253 return profilesList.selectedItem; | 1255 return profilesList.selectedItem; |
| 1254 } | 1256 } |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2012 } | 2014 } |
| 2013 button.textContent = loadTimeData.getString(strId); | 2015 button.textContent = loadTimeData.getString(strId); |
| 2014 }; | 2016 }; |
| 2015 } | 2017 } |
| 2016 | 2018 |
| 2017 // Export | 2019 // Export |
| 2018 return { | 2020 return { |
| 2019 BrowserOptions: BrowserOptions | 2021 BrowserOptions: BrowserOptions |
| 2020 }; | 2022 }; |
| 2021 }); | 2023 }); |
| OLD | NEW |