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