OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Helper object and related behavior that encapsulate messaging | 6 * @fileoverview Helper object and related behavior that encapsulate messaging |
7 * between JS and C++ for interacting with the Chrome Cleanup Tool. | 7 * between JS and C++ for interacting with the Chrome Cleanup Tool. |
8 */ | 8 */ |
9 | 9 |
10 /** | 10 /** |
11 * @typedef {{ | 11 * @typedef {{ |
12 * hasScanResults: boolean, | 12 * hasScanResults: boolean, |
13 * isInfected: boolean, | 13 * isInfected: boolean, |
14 * detectionStatusText: string, | 14 * detectionStatusText: string, |
15 * detectionTimeText: string, | 15 * detectionTimeText: string, |
16 * }} | 16 * }} |
17 */ | 17 */ |
18 var LastScanResult; | 18 var LastScanResult; |
19 | 19 |
| 20 /** |
| 21 * @typedef {{ |
| 22 * wasCancelled: boolean, |
| 23 * uwsRemoved: Array<string>, |
| 24 * requiresReboot: boolean, |
| 25 * }} |
| 26 */ |
| 27 var CleanupResult; |
| 28 |
20 cr.define('cleanup', function() { | 29 cr.define('cleanup', function() { |
21 /** @interface */ | 30 /** @interface */ |
22 function CleanupBrowserProxy() {} | 31 function CleanupBrowserProxy() {} |
23 | 32 |
24 CleanupBrowserProxy.prototype = { | 33 CleanupBrowserProxy.prototype = { |
25 /** | 34 /** |
26 * Fetch the result of the latest Chrome Cleanup Tool scanning task. | 35 * Fetch the result of the latest Chrome Cleanup Tool scanning task. |
27 * @return {!Promise<LastScanResult>} | 36 * @return {!Promise<LastScanResult>} |
28 */ | 37 */ |
29 requestLastScanResult: function() {}, | 38 requestLastScanResult: function() {}, |
30 /** | 39 /** |
31 * Attempts to run the Chrome Cleanup Tool in scanning mode. | 40 * Attempts to run the Chrome Cleanup Tool in scanning mode. |
32 * @return {!Promise<LastScanResult>} | 41 * @return {!Promise<LastScanResult>} |
33 */ | 42 */ |
34 startScan: function() {}, | 43 startScan: function() {}, |
| 44 |
| 45 /** |
| 46 * Opens the prompt to run the Chrome Cleanup Tool. |
| 47 * @return {!Promise<CleanupResult>} |
| 48 */ |
| 49 startCleanup: function() {}, |
35 }; | 50 }; |
36 | 51 |
37 /** | 52 /** |
38 * @constructor | 53 * @constructor |
39 * @implements {cleanup.CleanupBrowserProxy} | 54 * @implements {cleanup.CleanupBrowserProxy} |
40 */ | 55 */ |
41 function CleanupBrowserProxyImpl() {} | 56 function CleanupBrowserProxyImpl() {} |
42 cr.addSingletonGetter(CleanupBrowserProxyImpl); | 57 cr.addSingletonGetter(CleanupBrowserProxyImpl); |
43 | 58 |
44 CleanupBrowserProxyImpl.prototype = { | 59 CleanupBrowserProxyImpl.prototype = { |
45 /** @override */ | 60 /** @override */ |
46 requestLastScanResult: function() { | 61 requestLastScanResult: function() { |
47 return cr.sendWithPromise('requestLastScanResult'); | 62 return cr.sendWithPromise('requestLastScanResult'); |
48 }, | 63 }, |
49 /** @override */ | 64 /** @override */ |
50 startScan: function() { | 65 startScan: function() { |
51 return cr.sendWithPromise('startScan'); | 66 return cr.sendWithPromise('startScan'); |
52 }, | 67 }, |
| 68 /** @override */ |
| 69 startCleanup: function() { |
| 70 return cr.sendWithPromise('startCleanup'); |
| 71 }, |
53 }; | 72 }; |
54 | 73 |
55 return { | 74 return { |
56 CleanupBrowserProxy: CleanupBrowserProxy, | 75 CleanupBrowserProxy: CleanupBrowserProxy, |
57 CleanupBrowserProxyImpl: CleanupBrowserProxyImpl, | 76 CleanupBrowserProxyImpl: CleanupBrowserProxyImpl, |
58 } | 77 } |
59 }); | 78 }); |
OLD | NEW |