| OLD | NEW | 
|    1 // Copyright (c) 2011 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  |    7  | 
|    8   /** |    8   /** | 
|    9    * ImportDataOverlay class |    9    * ImportDataOverlay class | 
|   10    * Encapsulated handling of the 'Import Data' overlay page. |   10    * Encapsulated handling of the 'Import Data' overlay page. | 
|   11    * @class |   11    * @class | 
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   95       $('import-data-commit').disabled = !sensitive; |   95       $('import-data-commit').disabled = !sensitive; | 
|   96     }, |   96     }, | 
|   97  |   97  | 
|   98     /** |   98     /** | 
|   99      * Set enabled and checked states a checkbox element. |   99      * Set enabled and checked states a checkbox element. | 
|  100      * @param {Object} checkbox A checkbox element. |  100      * @param {Object} checkbox A checkbox element. | 
|  101      * @param {boolean} enabled The enabled state of the chekbox. |  101      * @param {boolean} enabled The enabled state of the chekbox. | 
|  102      * @private |  102      * @private | 
|  103      */ |  103      */ | 
|  104     setUpCheckboxState_: function(checkbox, enabled) { |  104     setUpCheckboxState_: function(checkbox, enabled) { | 
|  105        checkbox.setDisabled("noProfileData", !enabled); |  105        checkbox.setDisabled('noProfileData', !enabled); | 
|  106     }, |  106     }, | 
|  107  |  107  | 
|  108     /** |  108     /** | 
|  109      * Update the enabled and checked states of all checkboxes. |  109      * Update the enabled and checked states of all checkboxes. | 
|  110      * @private |  110      * @private | 
|  111      */ |  111      */ | 
|  112     updateCheckboxes_: function() { |  112     updateCheckboxes_: function() { | 
|  113       var index = $('import-browsers').selectedIndex; |  113       var index = $('import-browsers').selectedIndex; | 
|  114       var browserProfile; |  114       var browserProfile; | 
|  115       if (this.browserProfiles.length > index) |  115       if (this.browserProfiles.length > index) | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
|  135       var browserCount = browsers.length; |  135       var browserCount = browsers.length; | 
|  136  |  136  | 
|  137       if (browserCount == 0) { |  137       if (browserCount == 0) { | 
|  138         var option = new Option(templateData.noProfileFound, 0); |  138         var option = new Option(templateData.noProfileFound, 0); | 
|  139         browserSelect.appendChild(option); |  139         browserSelect.appendChild(option); | 
|  140  |  140  | 
|  141         this.setControlsSensitive_(false); |  141         this.setControlsSensitive_(false); | 
|  142       } else { |  142       } else { | 
|  143         this.setControlsSensitive_(true); |  143         this.setControlsSensitive_(true); | 
|  144         for (var i = 0; i < browserCount; i++) { |  144         for (var i = 0; i < browserCount; i++) { | 
|  145           var browser = browsers[i] |  145           var browser = browsers[i]; | 
|  146           var option = new Option(browser['name'], browser['index']); |  146           var option = new Option(browser['name'], browser['index']); | 
|  147           browserSelect.appendChild(option); |  147           browserSelect.appendChild(option); | 
|  148         } |  148         } | 
|  149  |  149  | 
|  150         this.updateCheckboxes_(); |  150         this.updateCheckboxes_(); | 
|  151         this.validateCommitButton_(); |  151         this.validateCommitButton_(); | 
|  152       } |  152       } | 
|  153     }, |  153     }, | 
|  154  |  154  | 
|  155     /** |  155     /** | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
|  181   }; |  181   }; | 
|  182  |  182  | 
|  183   /** |  183   /** | 
|  184    * Update the UI to reflect whether an import operation is in progress. |  184    * Update the UI to reflect whether an import operation is in progress. | 
|  185    * @param {boolean} state True if an import operation is in progress. |  185    * @param {boolean} state True if an import operation is in progress. | 
|  186    */ |  186    */ | 
|  187   ImportDataOverlay.setImportingState = function(state) { |  187   ImportDataOverlay.setImportingState = function(state) { | 
|  188     var checkboxes = |  188     var checkboxes = | 
|  189         document.querySelectorAll('#import-checkboxes input[type=checkbox]'); |  189         document.querySelectorAll('#import-checkboxes input[type=checkbox]'); | 
|  190     for (var i = 0; i < checkboxes.length; i++) |  190     for (var i = 0; i < checkboxes.length; i++) | 
|  191         checkboxes[i].setDisabled("Importing", state); |  191         checkboxes[i].setDisabled('Importing', state); | 
|  192     if (!state) |  192     if (!state) | 
|  193       ImportDataOverlay.getInstance().updateCheckboxes_(); |  193       ImportDataOverlay.getInstance().updateCheckboxes_(); | 
|  194     $('import-browsers').disabled = state; |  194     $('import-browsers').disabled = state; | 
|  195     $('import-throbber').style.visibility = state ? "visible" : "hidden"; |  195     $('import-throbber').style.visibility = state ? 'visible' : 'hidden'; | 
|  196     ImportDataOverlay.getInstance().validateCommitButton_(); |  196     ImportDataOverlay.getInstance().validateCommitButton_(); | 
|  197   }; |  197   }; | 
|  198  |  198  | 
|  199   /** |  199   /** | 
|  200    * Remove the import overlay from display. |  200    * Remove the import overlay from display. | 
|  201    */ |  201    */ | 
|  202   ImportDataOverlay.dismiss = function() { |  202   ImportDataOverlay.dismiss = function() { | 
|  203     ImportDataOverlay.clearUserPrefs(); |  203     ImportDataOverlay.clearUserPrefs(); | 
|  204     OptionsPage.closeOverlay(); |  204     OptionsPage.closeOverlay(); | 
|  205   }; |  205   }; | 
|  206  |  206  | 
|  207   /** |  207   /** | 
|  208    * Show a message confirming the success of the import operation. |  208    * Show a message confirming the success of the import operation. | 
|  209    */ |  209    */ | 
|  210   ImportDataOverlay.confirmSuccess = function() { |  210   ImportDataOverlay.confirmSuccess = function() { | 
|  211     var showBookmarksMessage = $('import-favorites').checked; |  211     var showBookmarksMessage = $('import-favorites').checked; | 
|  212     ImportDataOverlay.setImportingState(false); |  212     ImportDataOverlay.setImportingState(false); | 
|  213     $('import-data-configure').hidden = true; |  213     $('import-data-configure').hidden = true; | 
|  214     $('import-data-success').hidden = false; |  214     $('import-data-success').hidden = false; | 
|  215     $('import-find-your-bookmarks').hidden = !showBookmarksMessage; |  215     $('import-find-your-bookmarks').hidden = !showBookmarksMessage; | 
|  216   }; |  216   }; | 
|  217  |  217  | 
|  218   // Export |  218   // Export | 
|  219   return { |  219   return { | 
|  220     ImportDataOverlay: ImportDataOverlay |  220     ImportDataOverlay: ImportDataOverlay | 
|  221   }; |  221   }; | 
|  222 }); |  222 }); | 
| OLD | NEW |