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

Unified Diff: chrome/browser/resources/cleanup_tool/manager.js

Issue 2819633003: Cleanup Tool WebUI: Add functionality to the Cleanup button (Closed)
Patch Set: Fix typdef {[ -> {{ Created 3 years, 8 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/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) {
+ 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;
},
/**
« no previous file with comments | « chrome/browser/resources/cleanup_tool/manager.html ('k') | chrome/browser/ui/webui/cleanup_tool/cleanup_action_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698