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 81ad5884cdbf01b07c65a9c3a373c1e556314cb2..87da867bacd80c1dafbd014ef73532b225d599fd 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, |
| }, |
| @@ -59,7 +59,19 @@ 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; |
|
alito
2017/04/14 00:01:18
nit: space before '='
proberge
2017/04/18 19:24:28
Done.
|
| + if (!cleanupResults.wasCancelled) |
| + this.isInfected = false; |
|
alito
2017/04/14 00:01:18
Could you document why isInfected is set to false
proberge
2017/04/18 19:24:28
Done.
|
| + |
| + // TODO(proberge): Do something about cleanupResults.uwsRemoved. |
| }, |
| /** |
| @@ -86,13 +98,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) { |
| + 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 if the "Scanning" label should be displayed. |
|
alito
2017/04/14 00:01:18
nit: True if -> Whether
proberge
2017/04/18 19:24:28
Done.
|
| + * @private |
| + */ |
| + shouldShowScanning_: function(hasScanResults, isRunning) { |
| + return !hasScanResults && isRunning; |
| + }, |
| + |
| + /** |
| + * @param {boolean} hasScanResults |
| + * @param {boolean} isRunning |
| + * @return {boolean} True if the "Cleaning" label should be displayed. |
|
alito
2017/04/14 00:01:18
nit: True if -> Whether
proberge
2017/04/18 19:24:28
Done.
|
| * @private |
| */ |
| - shouldShowScan_: function(hasScanResults, isRunningScanner) { |
| - return !hasScanResults && !isRunningScanner; |
| + shouldShowCleaning_: function(hasScanResults, isRunning) { |
| + return hasScanResults && isRunning; |
| }, |
| /** |