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

Side by Side Diff: chrome/browser/resources/cleanup_tool/manager.js

Issue 2784653004: Cleanup Tool WebUI: Add HTML content and styling with dummy JS (Closed)
Patch Set: Update urls, address review comments 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 cr.define('cleanup', function() {
6 var Manager = Polymer({
7 is: 'cleanup-manager',
8
9 properties: {
10 hasScanResults: {
11 type: Boolean,
12 value: false,
13 },
14
15 isInfected: {
16 type: Boolean,
17 value: false,
18 },
19
20 isRunningScanner: {
21 type: Boolean,
22 value: false,
23 },
24
25 detectionStatusText: {
26 type: String,
27 value: ""
28 },
29
30 detectionTimeText: {
31 type: String,
32 value: ""
33 },
34 },
35
36 behaviors: [I18nBehavior],
37
38 /**
39 * Sends a request for Chrome to start the Cleanup Tool's scanning process.
40 * @private
41 */
42 onScanTap_: function() {
43 // TODO implement me.
44 },
45
46 /**
47 * Sends a request for Chrome to open the Cleanup Tool's cleanup prompt.
48 * @private
49 */
50 onCleanupTap_: function() {
51 // TODO implement me.
52 },
53
54 /**
55 * @param {boolean} hasScanResults
56 * @param {boolean} isInfected
57 * @return {string} A class name for icon-specific styling.
58 * @private
59 */
60 getIconClassName_: function(hasScanResults, isInfected) {
61 return hasScanResults && isInfected ? "infected-icon" : "clean-icon";
62 },
63
64 /**
65 * @param {boolean} hasScanResults
66 * @param {boolean} isInfected
67 * @return {string} An icon id. See icons.html.
68 * @private
69 */
70 getStatusIcon_: function(hasScanResults, isInfected) {
71 return hasScanResults && isInfected ?
72 "cleanup:infected-user" :
73 "cleanup:verified-user";
74 },
75
76 /**
77 * @param {boolean} hasScanResults
78 * @param {boolean} isRunningScanner
79 * @return {boolean} True if the "Scan" button should be displayed, false
80 * otherwise.
81 * @private
82 */
83 shouldShowScan_: function(hasScanResults, isRunningScanner) {
84 return !hasScanResults && !isRunningScanner;
85 }
86 });
87
88 /** @return {!cleanup.Manager} */
89 Manager.get = function() {
90 return /** @type {!cleanup.Manager} */ (
91 queryRequiredElement('cleanup-manager'));
92 }
93
94 /**
95 @param {boolean} hasScanResults Whether there are existing scan results.
96 @param {boolean} isInfected Whether the last scan found a program that the
97 Chrome Cleanup Tool can remove.
98 @param {string} detectionStatusText A pluralized and localized string
99 summarizing the scan results.
100 @param {string} detectionTimeText A pluralized and localized string
101 summarizing when the last scan took place.
102 */
103 Manager.setDetectionStatus = function(
104 hasScanResults, isInfected, detectionStatusText, detectionTimeText) {
105 var manager = Manager.get();
106
107 manager.hasScanResults = hasScanResults;
108 manager.isInfected = isInfected;
109 manager.detectionStatusText = detectionStatusText;
110 manager.detectionTimeText = detectionTimeText;
111 };
112
113 return {Manager: Manager};
114 });
115
116 // Fetch data while loading to have it displayed as soon as possible.
117 document.addEventListener('DOMContentLoaded', function() {
118 chrome.send('requestLastScanResult');
119 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698