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 var Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
| 7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * ImportDataOverlay class | 10 * ImportDataOverlay class |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 // Form controls are disabled until the profile list has been loaded. | 68 // Form controls are disabled until the profile list has been loaded. |
| 69 self.setAllControlsEnabled_(false); | 69 self.setAllControlsEnabled_(false); |
| 70 }, | 70 }, |
| 71 | 71 |
| 72 /** | 72 /** |
| 73 * Sets the enabled and checked state of the commit button. | 73 * Sets the enabled and checked state of the commit button. |
| 74 * @private | 74 * @private |
| 75 */ | 75 */ |
| 76 validateCommitButton_: function() { | 76 validateCommitButton_: function() { |
| 77 var somethingToImport = | 77 var somethingToImport = |
| 78 $('import-history').checked || $('import-favorites').checked || | 78 ($('import-history-with-label').style.display != 'none' && |
|
Dan Beam
2014/10/07 17:05:15
i think asking the checkbox itself if it's > 0 wid
Gaja
2014/10/08 04:50:07
I tried using '$(id).offsetWidth > 0', but during
Gaja
2014/10/08 05:02:48
So, falling back to previous check, i.e $(id).styl
Dan Beam
2014/10/08 21:36:23
well, if the markup ever changes or these checkbox
Gaja
2014/10/10 05:19:30
Done. Adding '-with-label' to 'el' and then passin
| |
| 79 $('import-passwords').checked || $('import-search').checked || | 79 $('import-history').checked) || |
| 80 $('import-autofill-form-data').checked; | 80 ($('import-favorites-with-label').style.display != 'none' && |
| 81 $('import-favorites').checked) || | |
| 82 ($('import-passwords-with-label').style.display != 'none' && | |
| 83 $('import-passwords').checked) || | |
| 84 ($('import-search-with-label').style.display != 'none' && | |
| 85 $('import-search').checked) || | |
| 86 ($('import-autofill-form-data-with-label').style.display != 'none' && | |
| 87 $('import-autofill-form-data').checked); | |
|
Dan Beam
2014/10/07 17:05:15
helper function?
function importable(type) {
Gaja
2014/10/08 04:50:07
Done. Thanks for the snippet.
| |
| 81 $('import-data-commit').disabled = !somethingToImport; | 88 $('import-data-commit').disabled = !somethingToImport; |
| 82 $('import-choose-file').disabled = !$('import-favorites').checked; | 89 $('import-choose-file').disabled = !$('import-favorites').checked; |
| 83 }, | 90 }, |
| 84 | 91 |
| 85 /** | 92 /** |
| 86 * Sets the enabled state of all the checkboxes and the commit button. | 93 * Sets the enabled state of all the checkboxes and the commit button. |
| 87 * @private | 94 * @private |
| 88 */ | 95 */ |
| 89 setAllControlsEnabled_: function(enabled) { | 96 setAllControlsEnabled_: function(enabled) { |
| 90 var checkboxes = | 97 var checkboxes = |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 270 ImportDataOverlay.getInstance().validateCommitButton_(); | 277 ImportDataOverlay.getInstance().validateCommitButton_(); |
| 271 | 278 |
| 272 PageManager.showPageByName('importData'); | 279 PageManager.showPageByName('importData'); |
| 273 }; | 280 }; |
| 274 | 281 |
| 275 // Export | 282 // Export |
| 276 return { | 283 return { |
| 277 ImportDataOverlay: ImportDataOverlay | 284 ImportDataOverlay: ImportDataOverlay |
| 278 }; | 285 }; |
| 279 }); | 286 }); |
| OLD | NEW |