OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 6 |
7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
8 | 8 |
9 // State variables. | 9 // State variables. |
10 var syncEnabled = false; | 10 var syncEnabled = false; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 showStopSyncingOverlay_: function(event) { | 89 showStopSyncingOverlay_: function(event) { |
90 AlertOverlay.show( | 90 AlertOverlay.show( |
91 localStrings.getString('stop_syncing_title'), | 91 localStrings.getString('stop_syncing_title'), |
92 localStrings.getString('stop_syncing_explanation'), | 92 localStrings.getString('stop_syncing_explanation'), |
93 localStrings.getString('stop_syncing_confirm_button_label'), | 93 localStrings.getString('stop_syncing_confirm_button_label'), |
94 undefined, | 94 undefined, |
95 function() { chrome.send('stopSyncing'); }); | 95 function() { chrome.send('stopSyncing'); }); |
96 }, | 96 }, |
97 | 97 |
98 setElementVisible_: function(element, visible) { | 98 setElementVisible_: function(element, visible) { |
99 element.style.display = visible ? 'inline' : 'none'; | 99 if (visible) |
| 100 element.classList.remove('hidden'); |
| 101 else |
| 102 element.classList.add('hidden'); |
100 }, | 103 }, |
101 | 104 |
102 setElementClassSyncError_: function(element, visible) { | 105 setElementClassSyncError_: function(element, visible) { |
103 visible ? element.classList.add('sync-error') : | 106 visible ? element.classList.add('sync-error') : |
104 element.classList.remove('sync-error'); | 107 element.classList.remove('sync-error'); |
105 }, | 108 }, |
106 | 109 |
107 setSyncEnabled_: function(enabled) { | 110 setSyncEnabled_: function(enabled) { |
108 this.syncEnabled = enabled; | 111 this.syncEnabled = enabled; |
109 }, | 112 }, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { | 171 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { |
169 $('themes_GTK_button').disabled = !enabled; | 172 $('themes_GTK_button').disabled = !enabled; |
170 } | 173 } |
171 }, | 174 }, |
172 | 175 |
173 setClassicThemeButtonEnabled_: function(enabled) { | 176 setClassicThemeButtonEnabled_: function(enabled) { |
174 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { | 177 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { |
175 $('themes_set_classic').disabled = !enabled; | 178 $('themes_set_classic').disabled = !enabled; |
176 } | 179 } |
177 }, | 180 }, |
| 181 |
| 182 hideSyncSection_: function() { |
| 183 this.setElementVisible_($('sync-section'), false); |
| 184 }, |
178 }; | 185 }; |
179 | 186 |
180 // Forward public APIs to private implementations. | 187 // Forward public APIs to private implementations. |
181 [ | 188 [ |
182 'setSyncEnabled', | 189 'setSyncEnabled', |
183 'setSyncSetupCompleted', | 190 'setSyncSetupCompleted', |
184 'setAccountPicture', | 191 'setAccountPicture', |
185 'setSyncStatus', | 192 'setSyncStatus', |
186 'setSyncStatusErrorVisible', | 193 'setSyncStatusErrorVisible', |
187 'setSyncActionLinkErrorVisible', | 194 'setSyncActionLinkErrorVisible', |
188 'setSyncActionLinkEnabled', | 195 'setSyncActionLinkEnabled', |
189 'setSyncActionLinkLabel', | 196 'setSyncActionLinkLabel', |
190 'setStartStopButtonVisible', | 197 'setStartStopButtonVisible', |
191 'setStartStopButtonEnabled', | 198 'setStartStopButtonEnabled', |
192 'setStartStopButtonLabel', | 199 'setStartStopButtonLabel', |
193 'setCustomizeButtonVisible', | 200 'setCustomizeButtonVisible', |
194 'setCustomizeButtonEnabled', | 201 'setCustomizeButtonEnabled', |
195 'setCustomizeButtonLabel', | 202 'setCustomizeButtonLabel', |
196 'setGtkThemeButtonEnabled', | 203 'setGtkThemeButtonEnabled', |
197 'setClassicThemeButtonEnabled', | 204 'setClassicThemeButtonEnabled', |
| 205 'hideSyncSection', |
198 ].forEach(function(name) { | 206 ].forEach(function(name) { |
199 PersonalOptions[name] = function(value) { | 207 PersonalOptions[name] = function(value) { |
200 PersonalOptions.getInstance()[name + '_'](value); | 208 PersonalOptions.getInstance()[name + '_'](value); |
201 }; | 209 }; |
202 }); | 210 }); |
203 | 211 |
204 // Export | 212 // Export |
205 return { | 213 return { |
206 PersonalOptions: PersonalOptions | 214 PersonalOptions: PersonalOptions |
207 }; | 215 }; |
208 | 216 |
209 }); | 217 }); |
OLD | NEW |