Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6379)

Unified Diff: chrome/browser/resources/options/import_data_overlay.js

Issue 636933002: [MAC] Disable 'Import' button when visible checkboxes are unchecked. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed. Using .hidden property in place of style.display Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/import_data_overlay.js
diff --git a/chrome/browser/resources/options/import_data_overlay.js b/chrome/browser/resources/options/import_data_overlay.js
index 600c9fa89b86771285d54a8b8d55779bd1d8caa0..11ce03efb79b8b62cec8d104126c7ad2a12d82c5 100644
--- a/chrome/browser/resources/options/import_data_overlay.js
+++ b/chrome/browser/resources/options/import_data_overlay.js
@@ -20,6 +20,14 @@ cr.define('options', function() {
cr.addSingletonGetter(ImportDataOverlay);
+ /**
+ * @param {string} type The type of data to import. Used in the element's ID.
+ */
+ function importable(type) {
+ var id = 'import-' + type;
+ return $(id).checked && !$(id + '-with-label').hidden;
+ }
+
ImportDataOverlay.prototype = {
// Inherit from Page.
__proto__: Page.prototype,
@@ -75,9 +83,9 @@ cr.define('options', function() {
*/
validateCommitButton_: function() {
var somethingToImport =
- $('import-history').checked || $('import-favorites').checked ||
- $('import-passwords').checked || $('import-search').checked ||
- $('import-autofill-form-data').checked;
+ importable('history') || importable('favorites') ||
+ importable('passwords') || importable('search') ||
+ importable('autofill-form-data');
$('import-data-commit').disabled = !somethingToImport;
$('import-choose-file').disabled = !$('import-favorites').checked;
},
@@ -128,11 +136,10 @@ cr.define('options', function() {
'search',
'autofill-form-data'];
for (var i = 0; i < importOptions.length; i++) {
- var checkbox = $('import-' + importOptions[i]);
+ var id = 'import-' + importOptions[i];
var enable = browserProfile && browserProfile[importOptions[i]];
- this.setUpCheckboxState_(checkbox, enable);
- var checkboxWithLabel = $('import-' + importOptions[i] + '-with-label');
- checkboxWithLabel.style.display = enable ? '' : 'none';
+ this.setUpCheckboxState_($(id), enable);
+ $(id + '-with-label').hidden = !enable;
}
},
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698