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); |
}, |
/** |