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 * An ImportantSite represents a domain with data that the user might want |
| 12 * to protect from being deleted. ImportantSites are determined based on |
| 13 * various engagement factors, such as whether a site is bookmarked or receives |
| 14 * notifications. |
| 15 * |
| 16 * @typedef {{ |
| 17 * registerableDomain: string, |
| 18 * reasonBitfield: number, |
| 19 * exampleOrigin: string, |
| 20 * isChecked: boolean, |
| 21 * storageSize: number, |
| 22 * hasNotifications: boolean |
| 23 * }} |
| 24 */ |
| 25 var ImportantSite; |
| 26 |
| 27 /** |
| 28 * @typedef {{ |
| 29 * importantSites: !Array<!ImportantSite>, |
| 30 * flagEnabled: boolean |
| 31 * }} |
| 32 */ |
| 33 var ImportantSitesResponse; |
| 34 |
10 cr.define('settings', function() { | 35 cr.define('settings', function() { |
11 /** @interface */ | 36 /** @interface */ |
12 function ClearBrowsingDataBrowserProxy() {} | 37 function ClearBrowsingDataBrowserProxy() {} |
13 | 38 |
14 ClearBrowsingDataBrowserProxy.prototype = { | 39 ClearBrowsingDataBrowserProxy.prototype = { |
15 /** | 40 /** |
16 * @return {!Promise} A promise resolved when data clearing has completed. | 41 * @param importantSites {!Array<!ImportantSite>} |
| 42 * @return {!Promise<void>} |
| 43 * A promise resolved when data clearing has completed. |
17 */ | 44 */ |
18 clearBrowsingData: function() {}, | 45 clearBrowsingData: function(importantSites) {}, |
| 46 |
| 47 /** |
| 48 * Fetches a list of important sites. |
| 49 * @return {!Promise<!ImportantSitesResponse>} |
| 50 * A promise resolved when imporant sites are fetched. |
| 51 */ |
| 52 fetchImportantSites: function() {}, |
19 | 53 |
20 /** | 54 /** |
21 * Kick off counter updates and return initial state. | 55 * Kick off counter updates and return initial state. |
22 * @return {!Promise<void>} Signal when the setup is complete. | 56 * @return {!Promise<void>} Signal when the setup is complete. |
23 */ | 57 */ |
24 initialize: function() {}, | 58 initialize: function() {}, |
25 }; | 59 }; |
26 | 60 |
27 /** | 61 /** |
28 * @constructor | 62 * @constructor |
29 * @implements {settings.ClearBrowsingDataBrowserProxy} | 63 * @implements {settings.ClearBrowsingDataBrowserProxy} |
30 */ | 64 */ |
31 function ClearBrowsingDataBrowserProxyImpl() {} | 65 function ClearBrowsingDataBrowserProxyImpl() {} |
32 cr.addSingletonGetter(ClearBrowsingDataBrowserProxyImpl); | 66 cr.addSingletonGetter(ClearBrowsingDataBrowserProxyImpl); |
33 | 67 |
34 ClearBrowsingDataBrowserProxyImpl.prototype = { | 68 ClearBrowsingDataBrowserProxyImpl.prototype = { |
35 /** @override */ | 69 /** @override */ |
36 clearBrowsingData: function() { | 70 clearBrowsingData: function(importantSites) { |
37 return cr.sendWithPromise('clearBrowsingData'); | 71 return cr.sendWithPromise('clearBrowsingData', importantSites); |
38 }, | 72 }, |
39 | 73 |
40 /** @override */ | 74 /** @override */ |
| 75 fetchImportantSites: function() { |
| 76 return cr.sendWithPromise('fetchImportantSites'); |
| 77 }, |
| 78 |
| 79 /** @override */ |
41 initialize: function() { | 80 initialize: function() { |
42 return cr.sendWithPromise('initializeClearBrowsingData'); | 81 return cr.sendWithPromise('initializeClearBrowsingData'); |
43 }, | 82 }, |
44 }; | 83 }; |
45 | 84 |
46 return { | 85 return { |
47 ClearBrowsingDataBrowserProxy: ClearBrowsingDataBrowserProxy, | 86 ClearBrowsingDataBrowserProxy: ClearBrowsingDataBrowserProxy, |
48 ClearBrowsingDataBrowserProxyImpl: ClearBrowsingDataBrowserProxyImpl, | 87 ClearBrowsingDataBrowserProxyImpl: ClearBrowsingDataBrowserProxyImpl, |
49 }; | 88 }; |
50 }); | 89 }); |
OLD | NEW |