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

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

Issue 2788743002: Cleanup Tool WebUI: Add functional HTML and skeleton JS for main content (Closed)
Patch Set: Fix typo and make manager.js closure deps include cleanup_browser_proxy 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 Polymer({
6 is: 'cleanup-manager',
7
8 properties: {
9 hasScanResults: {
10 type: Boolean,
11 value: false,
12 },
13
14 isInfected: {
15 type: Boolean,
16 value: false,
17 },
18
19 isRunningScanner: {
20 type: Boolean,
21 value: false,
22 },
23
24 detectionStatusText: {
25 type: String,
26 value: ""
27 },
28
29 detectionTimeText: {
30 type: String,
31 value: ""
32 },
33
34 /** @private {!cleanup.CleanupBrowserProxy} */
35 browserProxy_: Object,
36 },
37
38 /** @override */
39 attached: function() {
40 // Fetch data to have it displayed as soon as possible.
41 this.requestLastScanResult_();
42 },
43
44 /** @override */
45 created: function() {
46 this.browserProxy_ = cleanup.CleanupBrowserProxyImpl.getInstance();
47 },
48
49 /**
50 * Sends a request for Chrome to start the Cleanup Tool's scanning process.
51 * @private
52 */
53 onScanTap_: function() {
54 // TODO implement me.
55 },
56
57 /**
58 * Sends a request for Chrome to open the Cleanup Tool's cleanup prompt.
59 * @private
60 */
61 onCleanupTap_: function() {
62 // TODO implement me.
63 },
64
65 /**
66 * @param {boolean} hasScanResults
67 * @param {boolean} isInfected
68 * @return {string} A class name for icon-specific styling.
69 * @private
70 */
71 getIconClassName_: function(hasScanResults, isInfected) {
72 return hasScanResults && isInfected ? "infected-icon" : "clean-icon";
73 },
74
75 /**
76 * @param {boolean} hasScanResults
77 * @param {boolean} isInfected
78 * @return {string} An icon id. See icons.html.
79 * @private
80 */
81 getStatusIcon_: function(hasScanResults, isInfected) {
82 return hasScanResults && isInfected ?
83 "cleanup:infected-user" :
84 "cleanup:verified-user";
85 },
86
87 /**
88 * @param {boolean} hasScanResults
89 * @param {boolean} isRunningScanner
90 * @return {boolean} True if the "Scan" button should be displayed, false
91 * otherwise.
92 * @private
93 */
94 shouldShowScan_: function(hasScanResults, isRunningScanner) {
95 return !hasScanResults && !isRunningScanner;
96 },
97
98 /**
99 * Requests the latest Chrome Cleanup Tool scan results from Chrome, then
100 * updates the local state with the new information.
101 * @private
102 */
103 requestLastScanResult_: function() {
104 this.browserProxy_.requestLastScanResult().then(
105 this.updateLastScanState_.bind(this));
106 },
107
108 /**
109 @param {LastScanResult} lastScanResults
110 */
111 updateLastScanState_: function(lastScanResults) {
112 this.hasScanResults = lastScanResults.hasScanResults;
113 this.isInfected = lastScanResults.hasScanResults;
114 this.detectionStatusText = lastScanResults.detectionStatusText;
115 this.detectionTimeText = lastScanResults.detectionTimeText;
116 }
117 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/cleanup_tool/manager.html ('k') | chrome/browser/ui/webui/cleanup_tool/cleanup_tool_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698