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

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: Port in review changes on now-deleted main.html to cleanup.html 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 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.
62 return "infected-icon";
63 else
64 return "clean-icon";
65 },
66
67 /**
68 * @param {boolean} hasScanResults
69 * @param {boolean} isInfected
70 * @return {string} An icon id. See icons.html.
71 * @private
72 */
73 getStatusIcon_: function(hasScanResults, isInfected) {
74 if(hasScanResults && isInfected)
ftirelo 2017/03/29 20:59:11 Same as above.
proberge 2017/03/29 21:29:36 Done.
75 return "cleanup:infected-user";
76 else
77 return "cleanup:verified-user";
78 },
79
80 /**
81 * @param {boolean} hasScanResults
82 * @param {boolean} isRunningScanner
83 * @return {boolean} True if the "Scan" button should be displayed, false
84 * otherwise.
85 * @private
86 */
87 shouldShowScan_: function(hasScanResults, isRunningScanner) {
88 return !hasScanResults && !isRunningScanner;
89 }
90 });
91
92 /** @return {!cleanup.Manager} */
93 Manager.get = function() {
94 return /** @type {!cleanup.Manager} */ (
95 queryRequiredElement('cleanup-manager'));
96 }
97
98 /**
99 @param {boolean} hasScanResults Whether there are existing scan results.
100 @param {boolean} isInfected Whether the last scan found a program that the
101 Chrome Cleanup Tool can remove.
102 @param {string} detectionStatusText A pluralized and localized string
103 summarizing the scan results.
104 @param {string} detectionTimeText A pluralized and localized string
105 summarizing when the last scan took place.
106 */
107 Manager.setDetectionStatus = function(
108 hasScanResults, isInfected, detectionStatusText, detectionTimeText) {
109 var manager = Manager.get();
110
111 manager.hasScanResults = hasScanResults;
112 manager.isInfected = isInfected;
113 manager.detectionStatusText = detectionStatusText;
114 manager.detectionTimeText = detectionTimeText;
115 };
116
117 return {Manager: Manager};
118 });
119
120 // Fetch data while loading to have it displayed as soon as possible.
121 document.addEventListener('DOMContentLoaded', function() {
122 chrome.send('requestLastScanResult');
123 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698