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 ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; |
8 var RepeatingButton = cr.ui.RepeatingButton; | 8 var RepeatingButton = cr.ui.RepeatingButton; |
9 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; | 9 var HotwordSearchSettingIndicator = options.HotwordSearchSettingIndicator; |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 // Ensure that navigation events are unblocked on uber page. A reload of | 80 // Ensure that navigation events are unblocked on uber page. A reload of |
81 // the settings page while an overlay is open would otherwise leave uber | 81 // the settings page while an overlay is open would otherwise leave uber |
82 // page in a blocked state, where tab switching is not possible. | 82 // page in a blocked state, where tab switching is not possible. |
83 uber.invokeMethodOnParent('stopInterceptingEvents'); | 83 uber.invokeMethodOnParent('stopInterceptingEvents'); |
84 | 84 |
85 window.addEventListener('message', this.handleWindowMessage_.bind(this)); | 85 window.addEventListener('message', this.handleWindowMessage_.bind(this)); |
86 | 86 |
87 if (loadTimeData.getBoolean('allowAdvancedSettings')) { | 87 if (loadTimeData.getBoolean('allowAdvancedSettings')) { |
88 $('advanced-settings-expander').onclick = function() { | 88 $('advanced-settings-expander').onclick = function() { |
| 89 var showAdvanced = |
| 90 BrowserOptions.shouldShowSection_($('advanced-settings')); |
| 91 if (showAdvanced) { |
| 92 chrome.send('coreOptionsUserMetricsAction', |
| 93 ['Options_ShowAdvancedSettings']); |
| 94 } |
89 self.toggleSectionWithAnimation_( | 95 self.toggleSectionWithAnimation_( |
90 $('advanced-settings'), | 96 $('advanced-settings'), |
91 $('advanced-settings-container')); | 97 $('advanced-settings-container')); |
92 | 98 |
93 // If the link was focused (i.e., it was activated using the keyboard) | 99 // If the link was focused (i.e., it was activated using the keyboard) |
94 // and it was used to show the section (rather than hiding it), focus | 100 // and it was used to show the section (rather than hiding it), focus |
95 // the first element in the container. | 101 // the first element in the container. |
96 if (document.activeElement === $('advanced-settings-expander') && | 102 if (document.activeElement === $('advanced-settings-expander') && |
97 $('advanced-settings').style.height === '') { | 103 showAdvanced) { |
98 var focusElement = $('advanced-settings-container').querySelector( | 104 var focusElement = $('advanced-settings-container').querySelector( |
99 'button, input, list, select, a[href]'); | 105 'button, input, list, select, a[href]'); |
100 if (focusElement) | 106 if (focusElement) |
101 focusElement.focus(); | 107 focusElement.focus(); |
102 } | 108 } |
103 }; | 109 }; |
104 } else { | 110 } else { |
105 $('advanced-settings-expander').hidden = true; | 111 $('advanced-settings-expander').hidden = true; |
106 $('advanced-settings').hidden = true; | 112 $('advanced-settings').hidden = true; |
107 } | 113 } |
(...skipping 1744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 BrowserOptions.getLoggedInUsername = function() { | 1858 BrowserOptions.getLoggedInUsername = function() { |
1853 return BrowserOptions.getInstance().username_; | 1859 return BrowserOptions.getInstance().username_; |
1854 }; | 1860 }; |
1855 } | 1861 } |
1856 | 1862 |
1857 // Export | 1863 // Export |
1858 return { | 1864 return { |
1859 BrowserOptions: BrowserOptions | 1865 BrowserOptions: BrowserOptions |
1860 }; | 1866 }; |
1861 }); | 1867 }); |
OLD | NEW |