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

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

Issue 2784653004: Cleanup Tool WebUI: Add HTML content and styling with dummy JS (Closed)
Patch Set: Port in review changes on now-deleted main.html to cleanup.html Created 3 years, 9 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
new file mode 100644
index 0000000000000000000000000000000000000000..138d8d17bff27ec5c4bad6d61773d67774de3304
--- /dev/null
+++ b/chrome/browser/resources/cleanup_tool/manager.js
@@ -0,0 +1,123 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('cleanup', function() {
+ var Manager = Polymer({
+ is: 'cleanup-manager',
+
+ properties: {
+ hasScanResults: {
+ type: Boolean,
+ value: false,
+ },
+
+ isInfected: {
+ type: Boolean,
+ value: false,
+ },
+
+ isRunningScanner: {
+ type: Boolean,
+ value: false,
+ },
+
+ detectionStatusText: {
+ type: String,
+ value: ""
+ },
+
+ detectionTimeText: {
+ type: String,
+ value: ""
+ },
+ },
+
+ behaviors: [I18nBehavior],
+
+ /**
+ * Sends a request for Chrome to start the Cleanup Tool's scanning process.
+ * @private
+ */
+ onScanTap_: function() {
+ // TODO implement me.
+ },
+
+ /**
+ * Sends a request for Chrome to open the Cleanup Tool's cleanup prompt.
+ * @private
+ */
+ onCleanupTap_: function() {
+ // TODO implement me.
+ },
+
+ /**
+ * @param {boolean} hasScanResults
+ * @param {boolean} isInfected
+ * @return {string} A class name for icon-specific styling.
+ * @private
+ */
+ getIconClassName_: function(hasScanResults, isInfected) {
+ if(hasScanResults && isInfected)
ftirelo 2017/03/29 20:59:11 Nit: what about return hasScanResults && isInfe
proberge 2017/03/29 21:29:36 Done. Simple enough to not need a helper function.
+ return "infected-icon";
+ else
+ return "clean-icon";
+ },
+
+ /**
+ * @param {boolean} hasScanResults
+ * @param {boolean} isInfected
+ * @return {string} An icon id. See icons.html.
+ * @private
+ */
+ getStatusIcon_: function(hasScanResults, isInfected) {
+ if(hasScanResults && isInfected)
ftirelo 2017/03/29 20:59:11 Same as above.
proberge 2017/03/29 21:29:36 Done.
+ return "cleanup:infected-user";
+ else
+ return "cleanup:verified-user";
+ },
+
+ /**
+ * @param {boolean} hasScanResults
+ * @param {boolean} isRunningScanner
+ * @return {boolean} True if the "Scan" button should be displayed, false
+ * otherwise.
+ * @private
+ */
+ shouldShowScan_: function(hasScanResults, isRunningScanner) {
+ return !hasScanResults && !isRunningScanner;
+ }
+ });
+
+ /** @return {!cleanup.Manager} */
+ Manager.get = function() {
+ return /** @type {!cleanup.Manager} */ (
+ queryRequiredElement('cleanup-manager'));
+ }
+
+ /**
+ @param {boolean} hasScanResults Whether there are existing scan results.
+ @param {boolean} isInfected Whether the last scan found a program that the
+ Chrome Cleanup Tool can remove.
+ @param {string} detectionStatusText A pluralized and localized string
+ summarizing the scan results.
+ @param {string} detectionTimeText A pluralized and localized string
+ summarizing when the last scan took place.
+ */
+ Manager.setDetectionStatus = function(
+ hasScanResults, isInfected, detectionStatusText, detectionTimeText) {
+ var manager = Manager.get();
+
+ manager.hasScanResults = hasScanResults;
+ manager.isInfected = isInfected;
+ manager.detectionStatusText = detectionStatusText;
+ manager.detectionTimeText = detectionTimeText;
+ };
+
+ return {Manager: Manager};
+});
+
+// Fetch data while loading to have it displayed as soon as possible.
+document.addEventListener('DOMContentLoaded', function() {
+ chrome.send('requestLastScanResult');
+});

Powered by Google App Engine
This is Rietveld 408576698