| 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..90e646357eb8e500fa589971a75060faea87f812
|
| --- /dev/null
|
| +++ b/chrome/browser/resources/cleanup_tool/manager.js
|
| @@ -0,0 +1,119 @@
|
| +// 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) {
|
| + return hasScanResults && isInfected ? "infected-icon" : "clean-icon";
|
| + },
|
| +
|
| + /**
|
| + * @param {boolean} hasScanResults
|
| + * @param {boolean} isInfected
|
| + * @return {string} An icon id. See icons.html.
|
| + * @private
|
| + */
|
| + getStatusIcon_: function(hasScanResults, isInfected) {
|
| + return hasScanResults && isInfected ?
|
| + "cleanup:infected-user" :
|
| + "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');
|
| +});
|
|
|