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 /** @const */ var FocusOutlineManager = cr.ui.FocusOutlineManager; | 6 /** @const */ var FocusOutlineManager = cr.ui.FocusOutlineManager; |
| 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | |
| 8 | 7 |
| 9 var OptionsPage = { | 8 var OptionsPage = { |
| 10 /** | 9 /** |
| 11 * This is the absolute difference maintained between standard and | 10 * This is the absolute difference maintained between standard and |
| 12 * fixed-width font sizes. Refer http://crbug.com/91922. | 11 * fixed-width font sizes. Refer http://crbug.com/91922. |
| 13 * @const | 12 * @const |
| 14 */ | 13 */ |
| 15 SIZE_DIFFERENCE_FIXED_STANDARD: 3, | 14 SIZE_DIFFERENCE_FIXED_STANDARD: 3, |
| 16 | 15 |
| 17 /** | 16 /** |
| 18 * Initializes the complete options page. This will cause all C++ handlers | 17 * Initializes the complete options page. This will cause all C++ handlers |
| 19 * to be invoked to do final setup. | 18 * to be invoked to do final setup. |
| 20 */ | 19 */ |
| 21 initialize: function() { | 20 initialize: function() { |
| 22 chrome.send('coreOptionsInitialize'); | 21 chrome.send('coreOptionsInitialize'); |
| 23 }, | 22 }, |
| 24 | 23 |
| 25 /** | 24 /** |
| 26 * Shows the tab contents for the given navigation tab. | 25 * Shows the tab contents for the given navigation tab. |
| 27 * @param {!Element} tab The tab that the user clicked. | 26 * @param {Element} tab The tab that the user clicked. |
| 28 */ | 27 */ |
| 29 showTab: function(tab) { | 28 showTab: function(tab) { |
| 30 // Search parents until we find a tab, or the nav bar itself. This allows | 29 // Search parents until we find a tab, or the nav bar itself. This allows |
| 31 // tabs to have child nodes, e.g. labels in separately-styled spans. | 30 // tabs to have child nodes, e.g. labels in separately-styled spans. |
| 32 while (tab && !tab.classList.contains('subpages-nav-tabs') && | 31 while (tab && !tab.classList.contains('subpages-nav-tabs') && |
|
Dan Beam
2014/09/06 02:22:36
maybe add a check for tab.classList here?
Vitaly Pavlenko
2014/09/06 22:54:08
Why do we need to? I think classList is present in
Dan Beam
2014/09/09 02:59:09
document.documentElement.parentNode.classList is u
Vitaly Pavlenko
2014/09/09 17:54:51
Done.
| |
| 33 !tab.classList.contains('tab')) { | 32 !tab.classList.contains('tab')) { |
| 34 tab = tab.parentNode; | 33 tab = /** @type {Element} */(tab.parentNode); |
| 35 } | 34 } |
| 36 if (!tab || !tab.classList.contains('tab')) | 35 if (!tab || !tab.classList.contains('tab')) |
| 37 return; | 36 return; |
| 38 | 37 |
| 39 // Find tab bar of the tab. | 38 // Find tab bar of the tab. |
| 40 var tabBar = tab; | 39 var tabBar = tab; |
| 41 while (tabBar && !tabBar.classList.contains('subpages-nav-tabs')) { | 40 while (tabBar && !tabBar.classList.contains('subpages-nav-tabs')) { |
| 42 tabBar = tabBar.parentNode; | 41 tabBar = tabBar.parentNode; |
| 43 } | 42 } |
| 44 if (!tabBar) | 43 if (!tabBar) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 isSettingsApp: function() { | 101 isSettingsApp: function() { |
| 103 return document.documentElement.classList.contains('settings-app'); | 102 return document.documentElement.classList.contains('settings-app'); |
| 104 }, | 103 }, |
| 105 }; | 104 }; |
| 106 | 105 |
| 107 // Export | 106 // Export |
| 108 return { | 107 return { |
| 109 OptionsPage: OptionsPage | 108 OptionsPage: OptionsPage |
| 110 }; | 109 }; |
| 111 }); | 110 }); |
| OLD | NEW |