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

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

Issue 7390027: Added group policies to enable/disable importing of data from other browsers. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: . Created 9 years, 4 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 | « chrome/browser/resources/options/import_data_overlay.html ('k') | chrome/browser/resources/policy.html » ('j') | 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 71c8b42ff2930f70d420fb6f7f320dd1e9c1c08b..2671aad956c1fcecf6bbc700a5a09de22afe33f9 100644
--- a/chrome/browser/resources/options/import_data_overlay.js
+++ b/chrome/browser/resources/options/import_data_overlay.js
@@ -102,8 +102,7 @@ cr.define('options', function() {
* @private
*/
setUpCheckboxState_: function(checkbox, enabled) {
- checkbox.disabled = !enabled;
- checkbox.checked = enabled;
+ checkbox.setDisabled("noProfileData", !enabled);
},
/**
@@ -118,8 +117,8 @@ cr.define('options', function() {
var importOptions = ['history', 'favorites', 'passwords', 'search'];
for (var i = 0; i < importOptions.length; i++) {
var checkbox = $('import-' + importOptions[i]);
- this.setUpCheckboxState_(checkbox,
- browserProfile ? browserProfile[importOptions[i]] : false);
+ var enable = browserProfile && browserProfile[importOptions[i]];
+ this.setUpCheckboxState_(checkbox, enable);
}
},
@@ -152,6 +151,25 @@ cr.define('options', function() {
this.validateCommitButton_();
}
},
+
+ /**
+ * Clear import prefs set when user checks/unchecks a checkbox so that each
+ * checkbox goes back to the default "checked" state (or alternatively, to
+ * the state set by a recommended policy).
+ * @private
+ */
+ clearUserPrefs_: function() {
+ var importPrefs = ['import_history',
+ 'import_bookmarks',
+ 'import_saved_passwords',
+ 'import_search_engine'];
+ for (var i = 0; i < importPrefs.length; i++)
+ Preferences.clearPref(importPrefs[i], undefined);
+ },
+ };
+
+ ImportDataOverlay.clearUserPrefs = function() {
+ ImportDataOverlay.getInstance().clearUserPrefs_();
};
/**
@@ -167,15 +185,12 @@ cr.define('options', function() {
* @param {boolean} state True if an import operation is in progress.
*/
ImportDataOverlay.setImportingState = function(state) {
- if (state) {
- var checkboxes =
- document.querySelectorAll('#import-checkboxes input[type=checkbox]');
- for (var i = 0; i < checkboxes.length; i++) {
- checkboxes[i].disabled = true;
- }
- } else {
+ var checkboxes =
+ document.querySelectorAll('#import-checkboxes input[type=checkbox]');
+ for (var i = 0; i < checkboxes.length; i++)
+ checkboxes[i].setDisabled("Importing", state);
+ if (!state)
ImportDataOverlay.getInstance().updateCheckboxes_();
- }
$('import-browsers').disabled = state;
$('import-throbber').style.visibility = state ? "visible" : "hidden";
ImportDataOverlay.getInstance().validateCommitButton_();
@@ -185,6 +200,7 @@ cr.define('options', function() {
* Remove the import overlay from display.
*/
ImportDataOverlay.dismiss = function() {
+ ImportDataOverlay.clearUserPrefs();
OptionsPage.closeOverlay();
};
« no previous file with comments | « chrome/browser/resources/options/import_data_overlay.html ('k') | chrome/browser/resources/policy.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698