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

Unified Diff: chrome/browser/resources/settings/chrome_cleanup_page/chrome_cleanup_page.js

Issue 2971823002: Cleanup Tool WebUI: Add logs upload checkbox and minor polishing (Closed)
Patch Set: Address review comments on #3, simplify idle error cases Created 3 years, 5 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
Index: chrome/browser/resources/settings/chrome_cleanup_page/chrome_cleanup_page.js
diff --git a/chrome/browser/resources/settings/chrome_cleanup_page/chrome_cleanup_page.js b/chrome/browser/resources/settings/chrome_cleanup_page/chrome_cleanup_page.js
index 89dd30b24ae5ae34f797d10f2159d27c7117bcdd..25637213f61beb93ca828c0b8d759e3cd35c867c 100644
--- a/chrome/browser/resources/settings/chrome_cleanup_page/chrome_cleanup_page.js
+++ b/chrome/browser/resources/settings/chrome_cleanup_page/chrome_cleanup_page.js
@@ -66,9 +66,9 @@ Polymer({
},
/** @private */
- detailsDescription: {
- type: String,
- value: '',
+ showLogsPermission_: {
+ type: Boolean,
+ value: false,
},
/** @private */
@@ -94,6 +94,14 @@ Polymer({
type: String,
value: '',
},
+
+ /** @private {chrome.settingsPrivate.PrefObject} */
+ logsUploadPref_: {
+ type: Object,
+ value: function() {
+ return /** @type {chrome.settingsPrivate.PrefObject} */ ({});
+ },
+ },
},
/** @private {?settings.ChromeCleanupProxy} */
@@ -123,6 +131,9 @@ Polymer({
'chrome-cleanup-on-reboot-required', this.onRebootRequired_.bind(this));
this.addWebUIListener(
'chrome-cleanup-on-dismiss', this.onDismiss_.bind(this));
+ this.addWebUIListener(
+ 'chrome-cleanup-upload-permission-change',
+ this.onUploadPermissionChange_.bind(this));
this.browserProxy_.registerChromeCleanerObserver();
},
@@ -155,15 +166,13 @@ Polymer({
this.enableActionButton_(
this.i18n('chromeCleanupDoneButtonLabel'), this.dismiss_.bind(this));
this.setIconDone_();
- } else if (idleReason == settings.ChromeCleanupIdleReason.CLEANING_FAILED) {
+ } else {
+ // Scanning-related idle reasons are unexpected. Show an error message for
+ // all reasons other than |CLEANING_SUCCEEDED|.
this.title_ = this.i18n('chromeCleanupTitleErrorCantRemove');
this.enableActionButton_(
this.i18n('chromeCleanupDoneButtonLabel'), this.dismiss_.bind(this));
this.setIconWarning_();
- } else {
- // TODO(proberge): Handle other cases.
- this.title_ = '';
- this.disableActionButton_();
}
this.isRemoving_ = false;
@@ -214,6 +223,7 @@ Polymer({
this.resetIcon_();
this.disableActionButton_();
this.enableDetails_(files);
+ this.showLogsPermission_ = false;
},
/**
@@ -242,6 +252,27 @@ Polymer({
},
/**
+ * @param {boolean} enabled Whether logs upload is enabled.
+ * @private
+ */
+ onUploadPermissionChange_: function(enabled) {
+ this.logsUploadPref_ = {
+ key: '',
+ type: chrome.settingsPrivate.PrefType.BOOLEAN,
+ value: enabled,
+ };
+ },
+
+ /**
+ * @param {boolean} enabled Whether to enable logs upload.
+ * @private
+ */
+ changeLogsPermission_: function(enabled) {
+ var enabled = this.$.chromeCleanupLogsUploadControl.checked;
+ this.browserProxy_.setLogsUploadPermission(enabled);
+ },
+
+ /**
* Dismiss the card.
* @private
*/
@@ -278,7 +309,7 @@ Polymer({
*/
disableDetails_: function() {
this.showDetails_ = false;
- this.detailsDescription = '';
+ this.showLogsPermission_ = false;
this.showFilesToRemove_ = false;
this.filesToRemove_ = [];
},
@@ -290,7 +321,7 @@ Polymer({
*/
enableDetails_: function(files) {
this.showDetails_ = true;
- this.detailsDescription = this.i18n('chromeCleanupExplanation');
+ this.showLogsPermission_ = true;
// Note: doesn't change the state of this.showFilesToRemove_.
this.filesToRemove_ = files;
},
@@ -300,7 +331,8 @@ Polymer({
* @private
*/
startCleanup_: function() {
- this.browserProxy_.startCleanup();
+ this.browserProxy_.startCleanup(
+ this.$.chromeCleanupLogsUploadControl.checked);
},
/**

Powered by Google App Engine
This is Rietveld 408576698