OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 A helper object used from the "Clear browsing data" dialog | 6 * @fileoverview A helper object used from the "Clear browsing data" dialog |
7 * to interact with the browser. | 7 * to interact with the browser. |
8 */ | 8 */ |
9 | 9 |
| 10 /** |
| 11 * @typedef {{ |
| 12 * registerableDomain: string, |
| 13 * reasonBitfield: number, |
| 14 * exampleOrigin: string, |
| 15 * isChecked: boolean, |
| 16 * storageSize: number, |
| 17 * hasNotifications: boolean |
| 18 * }} |
| 19 */ |
| 20 var ImportantSite; |
| 21 |
| 22 /** |
| 23 * @typedef {{ |
| 24 * importantSites: Array<ImportantSite>, |
| 25 * flagEnabled: boolean |
| 26 * }} |
| 27 */ |
| 28 var ImportantSitesResponse; |
| 29 |
10 cr.define('settings', function() { | 30 cr.define('settings', function() { |
11 /** @interface */ | 31 /** @interface */ |
12 function ClearBrowsingDataBrowserProxy() {} | 32 function ClearBrowsingDataBrowserProxy() {} |
13 | 33 |
14 ClearBrowsingDataBrowserProxy.prototype = { | 34 ClearBrowsingDataBrowserProxy.prototype = { |
15 /** | 35 /** |
16 * @return {!Promise} A promise resolved when data clearing has completed. | 36 * @param importantSites {!Array<ImportantSite>} |
| 37 * @return {!Promise<void>} |
| 38 * A promise resolved when data clearing has completed. |
17 */ | 39 */ |
18 clearBrowsingData: function() {}, | 40 clearBrowsingData: function(importantSites) {}, |
| 41 |
| 42 /** |
| 43 * Fetches a list of important sites. |
| 44 * @return {!Promise<ImportantSitesResponse>} |
| 45 * A promise resolved when imporant sites are fetched. |
| 46 */ |
| 47 fetchImportantSites: function() {}, |
19 | 48 |
20 /** | 49 /** |
21 * Kick off counter updates and return initial state. | 50 * Kick off counter updates and return initial state. |
22 * @return {!Promise<void>} Signal when the setup is complete. | 51 * @return {!Promise<void>} Signal when the setup is complete. |
23 */ | 52 */ |
24 initialize: function() {}, | 53 initialize: function() {}, |
25 }; | 54 }; |
26 | 55 |
27 /** | 56 /** |
28 * @constructor | 57 * @constructor |
29 * @implements {settings.ClearBrowsingDataBrowserProxy} | 58 * @implements {settings.ClearBrowsingDataBrowserProxy} |
30 */ | 59 */ |
31 function ClearBrowsingDataBrowserProxyImpl() {} | 60 function ClearBrowsingDataBrowserProxyImpl() {} |
32 cr.addSingletonGetter(ClearBrowsingDataBrowserProxyImpl); | 61 cr.addSingletonGetter(ClearBrowsingDataBrowserProxyImpl); |
33 | 62 |
34 ClearBrowsingDataBrowserProxyImpl.prototype = { | 63 ClearBrowsingDataBrowserProxyImpl.prototype = { |
35 /** @override */ | 64 /** @override */ |
36 clearBrowsingData: function() { | 65 clearBrowsingData: function(importantSites) { |
37 return cr.sendWithPromise('clearBrowsingData'); | 66 return cr.sendWithPromise('clearBrowsingData', importantSites); |
38 }, | 67 }, |
39 | 68 |
40 /** @override */ | 69 /** @override */ |
| 70 fetchImportantSites: function() { |
| 71 return cr.sendWithPromise('fetchImportantSites'); |
| 72 }, |
| 73 |
| 74 /** @override */ |
41 initialize: function() { | 75 initialize: function() { |
42 return cr.sendWithPromise('initializeClearBrowsingData'); | 76 return cr.sendWithPromise('initializeClearBrowsingData'); |
43 }, | 77 }, |
44 }; | 78 }; |
45 | 79 |
46 return { | 80 return { |
47 ClearBrowsingDataBrowserProxy: ClearBrowsingDataBrowserProxy, | 81 ClearBrowsingDataBrowserProxy: ClearBrowsingDataBrowserProxy, |
48 ClearBrowsingDataBrowserProxyImpl: ClearBrowsingDataBrowserProxyImpl, | 82 ClearBrowsingDataBrowserProxyImpl: ClearBrowsingDataBrowserProxyImpl, |
49 }; | 83 }; |
50 }); | 84 }); |
OLD | NEW |