Chromium Code Reviews| Index: chrome/browser/resources/cleanup_tool/manager.js |
| diff --git a/chrome/browser/resources/cleanup_tool/manager.js b/chrome/browser/resources/cleanup_tool/manager.js |
| index d9bfa9a8fdcbe6a46aae7c31d8000c141bf35117..ce921d61d9f2e204ff1b3dc2d4f6f180e2cea938 100644 |
| --- a/chrome/browser/resources/cleanup_tool/manager.js |
| +++ b/chrome/browser/resources/cleanup_tool/manager.js |
| @@ -16,7 +16,7 @@ Polymer({ |
| value: false, |
| }, |
| - isRunningScanner: { |
| + isRunning: { |
| type: Boolean, |
| value: false, |
| }, |
| @@ -68,7 +68,21 @@ Polymer({ |
| * @private |
| */ |
| onCleanupTap_: function() { |
| - // TODO implement me. |
| + this.isRunning = true; |
| + this.browserProxy_.startCleanup().then(this.onCleanupResult_.bind(this)); |
| + }, |
| + |
| + /** |
| + * @param {CleanupResult} cleanupResults |
| + */ |
| + onCleanupResult_: function(cleanupResults) { |
| + this.isRunning = false; |
| + |
| + if (!cleanupResults.wasCancelled) |
| + // Assume cleanup was completed and clear infected status. |
| + this.isInfected = false; |
| + |
| + // TODO(proberge): Do something about cleanupResults.uwsRemoved. |
| }, |
| /** |
| @@ -95,13 +109,43 @@ Polymer({ |
| /** |
| * @param {boolean} hasScanResults |
| - * @param {boolean} isRunningScanner |
| - * @return {boolean} True if the "Scan" button should be displayed, false |
| - * otherwise. |
| + * @param {boolean} isRunning |
| + * @return {boolean} Whether the "Scan" button should be displayed. |
| + * @private |
| + */ |
| + shouldShowScan_: function(hasScanResults, isRunning) { |
|
tommycli
2017/04/26 16:10:33
Instead of all these shouldShowFoo_ methods that c
proberge
2017/04/26 17:28:38
Two of the methods are used by buttons, two are us
tommycli
2017/04/26 18:01:34
Ah, I see, I didn't realize they were different el
proberge
2017/04/26 18:06:20
Glad we agree :)
Will stay with the 4 methods for
|
| + return !hasScanResults && !isRunning; |
| + }, |
| + |
| + /** |
| + * @param {boolean} hasScanResults |
| + * @param {boolean} isRunning |
| + * @return {boolean} Whether the "Run Chrome Cleanup" button should be |
| + * displayed. |
| + * @private |
| + */ |
| + shouldShowClean_: function(hasScanResults, isRunning) { |
| + return hasScanResults && !isRunning; |
| + }, |
| + |
| + /** |
| + * @param {boolean} hasScanResults |
| + * @param {boolean} isRunning |
| + * @return {boolean} True Whether the "Scanning" label should be displayed. |
| + * @private |
| + */ |
| + shouldShowScanning_: function(hasScanResults, isRunning) { |
| + return !hasScanResults && isRunning; |
| + }, |
| + |
| + /** |
| + * @param {boolean} hasScanResults |
| + * @param {boolean} isRunning |
| + * @return {boolean} True Whether the "Cleaning" label should be displayed. |
| * @private |
| */ |
| - shouldShowScan_: function(hasScanResults, isRunningScanner) { |
| - return !hasScanResults && !isRunningScanner; |
| + shouldShowCleaning_: function(hasScanResults, isRunning) { |
| + return hasScanResults && isRunning; |
| }, |
| /** |