| 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 /** | 9 /** |
| 10 * ImportDataOverlay class | 10 * ImportDataOverlay class |
| 11 * Encapsulated handling of the 'Import Data' overlay page. | 11 * Encapsulated handling of the 'Import Data' overlay page. |
| 12 * @class | 12 * @class |
| 13 */ | 13 */ |
| 14 function ImportDataOverlay() { | 14 function ImportDataOverlay() { |
| 15 OptionsPage.call(this, | 15 OptionsPage.call(this, |
| 16 'importDataOverlay', | 16 'importDataOverlay', |
| 17 templateData.import_data_title, | 17 templateData.import_data_title, |
| 18 'import-data-overlay'); | 18 'import-data-overlay'); |
| 19 } | 19 } |
| 20 | 20 |
| 21 ImportDataOverlay.throbIntervalId = 0; | |
| 22 | |
| 23 cr.addSingletonGetter(ImportDataOverlay); | 21 cr.addSingletonGetter(ImportDataOverlay); |
| 24 | 22 |
| 25 ImportDataOverlay.prototype = { | 23 ImportDataOverlay.prototype = { |
| 26 // Inherit from OptionsPage. | 24 // Inherit from OptionsPage. |
| 27 __proto__: OptionsPage.prototype, | 25 __proto__: OptionsPage.prototype, |
| 28 | 26 |
| 29 /** | 27 /** |
| 30 * Initialize the page. | 28 * Initialize the page. |
| 31 */ | 29 */ |
| 32 initializePage: function() { | 30 initializePage: function() { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 document.querySelectorAll('#import-checkboxes input[type=checkbox]'); | 159 document.querySelectorAll('#import-checkboxes input[type=checkbox]'); |
| 162 for (var i = 0; i < checkboxes.length; i++) { | 160 for (var i = 0; i < checkboxes.length; i++) { |
| 163 checkboxes[i].disabled = true; | 161 checkboxes[i].disabled = true; |
| 164 } | 162 } |
| 165 } else { | 163 } else { |
| 166 ImportDataOverlay.getInstance().updateCheckboxes_(); | 164 ImportDataOverlay.getInstance().updateCheckboxes_(); |
| 167 } | 165 } |
| 168 $('import-browsers').disabled = state; | 166 $('import-browsers').disabled = state; |
| 169 $('import-data-commit').disabled = state; | 167 $('import-data-commit').disabled = state; |
| 170 $('import-throbber').style.visibility = state ? "visible" : "hidden"; | 168 $('import-throbber').style.visibility = state ? "visible" : "hidden"; |
| 171 | |
| 172 function advanceThrobber() { | |
| 173 var throbber = $('import-throbber'); | |
| 174 throbber.style.backgroundPositionX = | |
| 175 ((parseInt(getComputedStyle(throbber).backgroundPositionX, 10) - 16) | |
| 176 % 576) + 'px'; | |
| 177 } | |
| 178 if (state) { | |
| 179 ImportDataOverlay.throbIntervalId = setInterval(advanceThrobber, 30); | |
| 180 } else { | |
| 181 clearInterval(ImportDataOverlay.throbIntervalId); | |
| 182 } | |
| 183 }; | 169 }; |
| 184 | 170 |
| 185 /** | 171 /** |
| 186 * Remove the import overlay from display. | 172 * Remove the import overlay from display. |
| 187 */ | 173 */ |
| 188 ImportDataOverlay.dismiss = function() { | 174 ImportDataOverlay.dismiss = function() { |
| 189 ImportDataOverlay.setImportingState(false); | 175 ImportDataOverlay.setImportingState(false); |
| 190 OptionsPage.clearOverlays(); | 176 OptionsPage.clearOverlays(); |
| 191 } | 177 } |
| 192 | 178 |
| 193 // Export | 179 // Export |
| 194 return { | 180 return { |
| 195 ImportDataOverlay: ImportDataOverlay | 181 ImportDataOverlay: ImportDataOverlay |
| 196 }; | 182 }; |
| 197 | 183 |
| 198 }); | 184 }); |
| OLD | NEW |