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 cr.define('cleanup', function() { | 20 cr.define('cleanup', function() { |
21 /** @interface */ | 21 /** @interface */ |
22 function CleanupBrowserProxy() {} | 22 function CleanupBrowserProxy() {} |
23 | 23 |
24 CleanupBrowserProxy.prototype = { | 24 CleanupBrowserProxy.prototype = { |
25 /** | 25 /** |
26 * Fetch the result of the latest Chrome Cleanup Tool scanning task. | 26 * Fetch the result of the latest Chrome Cleanup Tool scanning task. |
27 * @return {!Promise<LastScanResult>} | 27 * @return {!Promise<LastScanResult>} |
28 */ | 28 */ |
29 requestLastScanResult: function() {}, | 29 requestLastScanResult: function() {}, |
| 30 /** |
| 31 * Attempts to run the Chrome Cleanup Tool in scanning mode. |
| 32 * @return {!Promise<LastScanResult>} |
| 33 */ |
| 34 startScan: function() {}, |
30 }; | 35 }; |
31 | 36 |
32 /** | 37 /** |
33 * @constructor | 38 * @constructor |
34 * @implements {cleanup.CleanupBrowserProxy} | 39 * @implements {cleanup.CleanupBrowserProxy} |
35 */ | 40 */ |
36 function CleanupBrowserProxyImpl() {} | 41 function CleanupBrowserProxyImpl() {} |
37 cr.addSingletonGetter(CleanupBrowserProxyImpl); | 42 cr.addSingletonGetter(CleanupBrowserProxyImpl); |
38 | 43 |
39 CleanupBrowserProxyImpl.prototype = { | 44 CleanupBrowserProxyImpl.prototype = { |
40 /** @override */ | 45 /** @override */ |
41 requestLastScanResult: function() { | 46 requestLastScanResult: function() { |
42 return cr.sendWithPromise('requestLastScanResult'); | 47 return cr.sendWithPromise('requestLastScanResult'); |
43 }, | 48 }, |
| 49 /** @override */ |
| 50 startScan: function() { |
| 51 return cr.sendWithPromise('startScan'); |
| 52 }, |
44 }; | 53 }; |
45 | 54 |
46 return { | 55 return { |
47 CleanupBrowserProxy: CleanupBrowserProxy, | 56 CleanupBrowserProxy: CleanupBrowserProxy, |
48 CleanupBrowserProxyImpl: CleanupBrowserProxyImpl, | 57 CleanupBrowserProxyImpl: CleanupBrowserProxyImpl, |
49 } | 58 } |
50 }); | 59 }); |
OLD | NEW |